Following are the changes and enhancements at the language level for Java 5.0
Generics
This long-awaited enhancement to the type system allows a type or method to operate on objects of various types while providing compile-time type safety. It adds compile-time type safety to the Collections Framework and eliminates the drudgery of casting.
Enhanced for Loop
This new language construct eliminates the drudgery and error-proneness of iterators and index variables when iterating over collections and arrays
Autoboxing/Unboxing
This facility eliminates the drudgery of manual conversion between primitive types (such as int) and wrapper types (such as Integer).
Typesafe Enums
This flexible object-oriented enumerated type facility allows you to create enumerated types with arbitrary methods and fields. It provides all the benefits of the Typesafe Enum pattern ("Effective Java," Item 21) without the verbosity and the error-proneness.
Varargs
This facility eliminates the need for manually boxing up argument lists into an array when invoking methods that accept variable-length argument lists.
Static Import
This facility lets you avoid qualifying static members with class names without the shortcomings of the "Constant Interface antipattern."
Metadata (Annotations)
This language feature lets you avoid writing boilerplate code under many circumstances by enabling tools to generate it from annotations in the source code. This leads to a "declarative" programming style where the programmer says what should be done and tools emit the code to do it. Also it eliminates the need for maintaining "side files" that must be kept up to date with changes in source files. Instead the information can be maintained in the source file.
For more features and enhancements in Java 5.0, visit Sun's official page.
For Java 6.0 (a.k.a Mustang), no significant changes at the language level, but comes with a bunch of enhancements in the other areas like Core, XML and Desktop. Most of the features are applicable both to J2SE and J2EE Platforms. New features and enhancements are encapsulated in the form of a Java Specification Request (JSR). Below is list of features we will use frequently (IMHO) in the near future.
Pluggable Annotation Processing API (JSR 269)
Common Annotations (JSR 250)
Java API for XML Based Web Services - 2.0 (JSR 224)
JAXB 2.0 (JSR 222)
Web Services Metadata (JSR 181)
Streaming API for XML (JSR 173)
JDBC 4.0 (JSR 221)
Scripting in the Java Platform (JSR 223)
For the explanation and example of each, you can go through the article (part 1 and 2) written by Shunmuga Raja. For comprehensive features and enhancements in Java 6.0, visit Sun official page.
Highscalability is Up For Sale
11 months ago
No comments:
Post a Comment