Monday, October 31, 2011

JDK 1.7 Language Enhancements

In this blog, I will mainly discuss Java SE 7 platform language enhancements with examples.

The following new language enhancements are shipped in Java SE 7 platform.
  • String Values With Switch Statements
  • Improved Integral Literals
  • "Try with resources" statements
  • Diamond Operator <>
  • Simplified varargs method invocation
  • Multi-catch blocks

Strings Values with Switch Statements

Before Java SE 7, We can use integer or byte value in switch statement. In Java SE 7, string value can be enabled in switch statement.

Improved Integral Literals

Binary Literal can be represented directly instead of hexadecimal.

we can insert underscore(_) as deliminator in number. It can not be used at starting and ending.



No comments: