Posts

Showing posts from October, 2012

The 55 New Java 7 Features

Image
Binary Literals int mask = 0b101010101010; aShort = (short)0b1010000101000101; long aLong = 0b1010000101000101101000010100010110100001010001011010000101000101L; HAPPY_FACE = { (short)0b0000011111100000; (short)0b0000100000010000; (short)0b0001000000001000; (short)0b0010000000000100; (short)0b0100000000000010; (short)0b1000011001100001; (short)0b1000011001100001;                     (short)0b1000000000000001; (short)0b1000000000000001; (short)0b1001000000001001; (short)0b1000100000010001; (short)0b0100011111100010; (short)0b0010000000000100; (short)0b0001000000001000; (short)0b0000100000010000; (short)0b0000011111100000; }                     Underscores in Numeric Literals • Valid: int mask = 0b1010_1010_1010; long big = 9_223_783_036_967_937L; long creditCardNumber = 1234_5678_9012_3456L; long socialSecurityNumber = 999_99_9999L; float pi = 3.14_15F; long hexBytes = 0xFF_EC_DE_5E; long hexWords = 0xCAFE_BFFE; • Invalid: float pi1 = 3_.1415F;floa