Welcome Guest!
Create Account | Login
Locator+ Code:

Search:
FTPOnline Channels Conferences Resources Hot Topics Partner Sites Magazines About FTP RSS 2.0 Feed


email article
printer friendly
more resources

Take the Fast Track to J2SE 1.5
JCP experts listened and developed the best developer platform. Discover how new J2SE 1.5 features can streamline your code
by Calvin Austin

Posted June 7, 2004

Nearly three years ago the design of one of the most significant updates to the Java platform in its history was planned. So what has happened in those three years? J2SE 1.5 ("Tiger") has been developed through the Java Community Process (JCP), and in addition to the 18 experts on the J2SE 1.5 JSR (JSR 176) there are an additional 15 component JSRs (see Table 1), each with their own domain experts. In addition to Java luminaries such as James Gosling and Graham Hamilton, over 160 Java experts worldwide have contributed to its design. The common goal was to make Java the best developer platform available, and I trust you will agree that we have listened very carefully to what the Java community wanted. Let's take a look at the information you need to get up to speed with J2SE 1.5, including code examples that you can run with the beta release that is available currently.

ADVERTISEMENT

Although there are over 100 major features, the release is focused along certain key themes, namely, quality, ease of development, monitoring and manageability, performance and scalability, and desktop client. There are a few features that didn't fit neatly into the themes, and we'll look at those later.

Note that even if you do not change a single line of your existing application there are many features in J2SE 1.5 that you can take advantage of by just migrating to the new release. Be sure to try out the new beta, run your existing code, and then try some of the great new language features.

Language Changes and More
Perhaps the most talked about features in this release are the new Java language changes. Some of these changes have been covered in detail in several recent Java Pro articles. However, the ease of development theme covers much more than the Java language updates. There are other changes to make it easier for developer tools to work with the Java platform and also a whole new locking and threading framework.

The javac compiler uses the 1.5 language features by default. To use any of the examples you see here with the beta 1 release, you will need to add the option -source 1.5 when using the javac compiler:

javac -source 1.5 Hello.java

The primary ease of development changes and the respective JSR in which they were developed are shown in Table 2. Arguably, the most significant language change delivered with J2SE 1.5 is the introduction of Generic types. Generic types provide the ability for API designers to create common code that can be used with any Java reference type and yet can be checked for type safety at compile time. The Collections API is a good example of an API that can benefit from Generic types and has already been updated in the 1.5 release. In addition, any APIs that call the Collection API inside the core platform have also been retrofitted with a Generic signature, along with the Class API. To see Generics types in action, consider this ArrayList example that uses the 1.4.2 release:

ArrayList list = 
	 new ArrayList();
list.add(0, "User1"); 
String firstuser= (
	String)list.get(0);



Back to top













Java Pro | Visual Studio Magazine | Windows Server System Magazine
.NET Magazine | Enterprise Architect | XML & Web Services Magazine
| | Discussions | Newsletters | FTP Home