Tutorial List
Home
Interview Questions
Interview
Interview Questions
Links
Web Home
About Us

New features in java 5

New feature in java 1.5:
There are many featured added to Java 1.5 version but here are few most used and popular one,
    * Generics: Provides compile-time (static) type safety for collections and     eliminates the need for most typecasts (type conversion).
    * Metadata: Also called annotations; allows language constructs such as classes and methods to be tagged with additional data, which can then be processed by metadata-aware utilities.
    * Autoboxing/unboxing: Automatic conversions between primitive types (such as int) and primitive wrapper classes (such as Integer).

    * Enumerations: The enum keyword creates a typesafe, ordered list of values (such as Day.MONDAY, Day.TUESDAY, etc.). Previously this could only be achieved by non-typesafe constant integers or manually constructed classes (typesafe enum pattern).

    * Enhanced for each loop: The for loop syntax is extended with special syntax for iterating over each member of either an array or any Iterable, such as the standard Collection classes, using a construct of the form:

    * Swing: New skinnable look and feel, called synth.

    * Varargs: The last parameter of a method can now be declared using a type name followed by three dots (e.g. void drawtext(String... lines)). In the calling code any number of parameters of that type can be used and they are then placed in an array to be passed to the method, or alternatively the calling code can pass an array of that type.

No comments: