Java SE7 Features

-Binary literals, (using prefix 0b or oB)
-Underscores in numeric literals
-string in switch statements
-type inference for Generic instance creation
Map<String, List<String>> myMap = new HashMap<String, List<String>>();
In Java SE 7, you can substitute the parameterized type of the constructor with an empty set of type parameters (<>):
Map<String, List<String>> myMap = new HashMap<>();
-Caching Multiple exception
-Rethrowing exception with improved type checking
-try with resources statements
try(FileInputStream input = new FileInputStream(“file.txt”)) close automatically input stream, using AutoClosable interface
using multiple resources
try( FileInputStream input = new FileInputStream(“file.txt”);
BufferedInputStream bufferedInput = new BufferedInputStream(input)
) {}

ref:

http://docs.oracle.com/javase/7/docs/technotes/guides/language/enhancements.html#javase7

http://tutorials.jenkov.com/java-exception-handling/try-with-resources.html

 

 

Leave a comment