Saturday, December 1, 2018

Java 5-to-7 Feature History at a Glance

Java Features and Enhancements

Java5

Java5 has revolutionary enhancements upon its earlier release which is JDK4

The salient features were

Generics - Java enhancement to type safety, allows objects and methods to predefine acceptable types, thereby providing compile-time type safety. It also brings much relief to collections framework in providing compile-time type safety and eliminates the perils of type-casting.

Enhanced for loop - Looping without indexes i.e directly on the array itself

for(declaration : expression)
{
 // declaration-block variable to hold temp data
 // expression - the array to traverse
  
//your code logic comes here
}

Autoboxing/Unboxing

Varargs - Variable arguments

Typesafe Enums

static Imports - reduces the redundancy os typing the classname always for refering to static class variables

Annotations (Metadata) - relief from complex xml based mappings

Instrumentation

http://javapapers.com/core-java/java-features-and-history/

No comments:

Post a Comment