Java Version History - J2SE 5.0 (September 30, 2004)

J2SE 5.0 (September 30, 2004)

Codename Tiger. Originally numbered 1.5, which is still used as the internal version number. This version was developed under JSR 176.

J2SE 5.0 entered its end-of-life on April 8, 2008 and is no longer supported by Sun as of November 3, 2009.

Tiger added a number of significant new language features:

  • Generics: Provides compile-time (static) type safety for collections and eliminates the need for most typecasts (type conversion). (Specified by JSR 14.)
  • 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. (Specified by JSR 175.)
  • Autoboxing/unboxing: Automatic conversions between primitive types (such as int) and primitive wrapper classes (such as Integer). (Specified by JSR 201.)
  • 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). (Specified by JSR 201.)
  • 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.
  • 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:
void displayWidgets (Iterable widgets) { for (Widget w: widgets) { w.display; } }

This example iterates over the Iterable object widgets, assigning each of its items in turn to the variable w, and then calling the Widget method display for each item. (Specified by JSR 201.)

  • Fix the previously broken semantics of the Java Memory Model, which defines how threads interact through memory.
  • Static imports

There were also the following improvements to the standard libraries:

  • Automatic stub generation for RMI objects.
  • Swing: New skinnable look and feel, called synth.
  • The concurrency utilities in package java.util.concurrent.
  • Scanner class for parsing data from various input streams and buffers.

Java 5 is the last release of Java to officially support the Microsoft Windows 9x line (Windows 95, Windows 98, Windows ME), while Windows Vista is the newest version of Windows that J2SE 5 was supported on prior to Java 5 going end of life in October 2009.

Java 5 is the default version of Java installed on Apple Mac OS X 10.5 (Leopard). Java 6 can be installed and set as the default to be used on 64-bit (Core 2 Duo and higher) processor machines. Java 6 is also supported by 32-bit machines running Mac OS X 10.6 (Snow Leopard).

Read more about this topic:  Java Version History