1, JDK1.6 the previous version only supports byte, char, short, int, enum,
JDK1.7 increase of type String
2, the use of List <String> tempList = new ArrayList <> (); i.e., a generic example of the type automatically infer
(1) the use of generic types in the previous version, it is necessary at the time of declaration and assignment, both sides plus the generic type. E.g:
Map<String, String> myMap = new HashMap<String, String>();
(2) in Java SE 7, is improved in this way, now you can use the following statement to be declared and assignment:
Map <String, String> = the myMap new new the HashMap <> (); // note that after the "<>"
Support the collection of grammar, but not necessarily the array
final List<Integer> lists= [ 1,2,3,4,5,6];
Add some method to take environmental information tools
System.getJavaIoTempDir File () // IO temporary folder File System.getJavaHomeDir () // the JRE installation directory File System.getUserHomeDir () // current user directory File System.getUserDir () // directory where java process starts 5
switch can be used in a string
String s = "test"; switch (s) { case "test" : System.out.println("test"); case "test1" : System.out.println("test1"); break ; default : System.out.println("break"); break ; }
Digital literal underscore support for
a very long number readability bad, you can use an underscore in Java 7 that separates the long int and long, such as:
int = one_million 1_000_000;
first remove the underscore operation,
Such as: * 10 = 110,120 1_1 - 1_0 = 110