Monday, July 25, 2011

What are new features in Java 7 or JDK7?

I was looking at all new features of Java 7. List of features include to simplify common, day-to-day programming tasks: Strings in switch statements, try-with-resources statements, improved type inference for generic instance creation ("diamond" or "<>"), simplified varargs method invocation, better integral literals, improved exception handling (multi-catch), and my favorite feature fork-join framework. I found many blog posts mentioning them. I developed following simple examples to demonstrate all new JDK7 features. Click on following links to see the example code and its detailed explanation:

JDK7 feature's list of examples:
  1. An example of new feature in JDK 7 which can do type inference for generic instance creation.
  2. Try-with-resources statement
  3. String object is allowed in switch-case statement
  4. Catch multiple exceptions in a single catch block & more precise exception re-throw example
  5. Express literal values in binary with prefix '0b' (or '0B') for integral types (byte, short, int and long)
  6. Fork-Join Framework for supporting Parallel Programming
  7. Performance comparison of Executor framework vs ForkJoin framework’s RecursiveTask feature in java or JDK7 
  8. More informative varargs warnings

Following are few links/posts I found informative and useful:
  1. 7 new cool features in Java 7:
  2. Hidden Java 7 Features – System and Process CPU Load Monitoring:
  3. JDK 7 Features: 
  4. Java Fork/Join for Parallel Programming:
  5. New Java 7 Language Features:
There are lots of new goodies, I will add more details regarding Java 7 features once I am ready with running examples.

Recently, I read about Java 7 having some severe bugs. Quoting "Some loops are mis-compiled due to errors in the HotSpot compiler optimizations, which causes programs to fail. This bug affects several Apache projects directly — Apache Lucene Core and Apache Solr have already raised a warning, noting that the bug might be present in Java 6 as well." For more details visit following blogs:
  1. Java7 Hotspot Loop Bug Details:
  2. Java 7 Ships With Severe Bug: 
  3. Don’t Use Java 7, For Anything:

    No comments:

    Post a Comment

    Example code to connect node.js REST service with Eureka discovery service

    Eureka is Spring based discovery service developed by Netflix. To know how Eureka is used at Netflix visit: