Translate

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: http://sellmic.com/blog/2011/07/08/7-new-cool-features-in-java-7/
  2. Hidden Java 7 Features – System and Process CPU Load Monitoring: http://sellmic.com/blog/2011/07/21/hidden-java-7-features-cpu-load-monitoring/
  3. JDK 7 Features: http://openjdk.java.net/projects/jdk7/features/ 
  4. Java Fork/Join for Parallel Programming: http://www.javacodegeeks.com/2011/02/java-forkjoin-parallel-programming.html
  5. New Java 7 Language Features: http://java.dzone.com/articles/new-java-7-language-features?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+zones%2Fnetbeans+%28NetBeans+Zone%29
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: http://www.infoq.com/news/2011/08/java7-hotspot
  2. Java 7 Ships With Severe Bug: http://developers.slashdot.org/story/11/07/29/1639233/Java-7-Ships-With-Severe-Bug?utm_source=slashdot&utm_medium=twitter 
  3. Don’t Use Java 7, For Anything: http://www.lucidimagination.com/blog/2011/07/28/dont-use-java-7-for-anything/

    No comments:

    Post a Comment