Java 1.4 Vs. Java 1.5
Java 1.5, otherwise known as Java 5.0, is the next to latest release of the Java programming language and virtual machine, the latest being 1.6.0/6.0, and the previous major release being 1.4.0/4.0. Java 1.5 makes a number of advances over its predecessor, in language features, the virtual machine, the base libraries, and others.
-
Language Features
-
Java now includes an option for performing a for-each loop through any structure that implements the Collection interface using this syntax: for (String str : Collection<String> array) { /* DO SOMETHING */ }
The above example also shows Java's new support for generics. Now, rather than performing an unsafe and potentially bug-prone cast operation to pull an object out of a collection, a collection may have the type of object within it specified using the arrow bracket syntax.
Improvements to the Virtual Machine
-
The underlying virtual machine also includes a number of enhancements. The VM now loads all classes from a running JAR file to an internal, shared archive where they can be accessed by other processes running on the VM, improving efficiency for classes that are likely to be used by a wide variety of simultaneously running processes. Improvements have also been made to the efficiency of the garbage collector, thread priority mapping, and fatal error diagnostics.
-
Base Libraries
-
The base libraries have received a wide variety of enhancements. Some notables include: Lang and Util now have a Formatter class containing a variety of tools to help with common string formatting problems. The new scanner class can be used to convert text into primitives and strings, as well as conduct regular expression searches on files, streams, and other implementors of the Readable interface. A number of tools have been added to assist in concurrent and multithreaded programming.
Integration Libraries
-
The Remote Method Invocation has been enhanced. It now supports the dynamic generation of stub classes at runtime. SSL and TSL socket factory classes have been added to simplify communication over the SSL and TLS protocols. Enhancement have also been made to the Java Database Connectivity (JDBC) package, particularly in the RowSet interface, which provides an easy way to pass data from a database connection between components. There are five standard implementations. There are also new features for CORBA, Java IDL, Java RMI-IIOP, and the JNDI.
User Interface
-
There are a number of enhancements for the Java user interface packages. Swing includes two new look and feels: a skinnable look and feel named Synth and Ocean. JTable now has support for printing. AWT includes a MouseInfo class that provides information about mouse position. Java Sound has enhanced support for MIDI devices. Also, a number of enhancements have been added to support internationalization of software.
-
References
Resources
- Photo Credit Image by Flickr.com, courtesy of Tony