Saturday, May 24, 2014

New Features of Java 7

Java 7 contains many new features, enhancements and bug fixes to improve efficiency to develop and run Java programs.

Here is a brief summary of the enhancements included with the Java 7 release:

  • Improved performance, stability and security.
  • Enhancements in the Java Plug-in for Rich Internet Applications development and deployment.
  • Java Programming language enhancements that enable developers with ease of writing and optimizing the Java code.
  • Enhancements in the Java Virtual machine to support Non-Java languages.

In this article, we will explore some of those capabilities through code samples.

1. Binary literals

You can use the binary number system (0s and 1s) to express integral types byte, short, int, and long. To specify a binary value, prefix the value with a 0b or 0B.


--------------------- Output ---------------------
a = -88
b = 112
c = 73
d = 1467

2. Underscore literals

To improve readability of numeric literals in the code, you can use underscores between digits to separate a group of digits. You can use as many underscores as you need.


--------------------- Output ---------------------
a = -86
b = 4554
c = 123456789
d = 111222333
e = 11.227799