Presents your JAVA E-NEWSLETTER for March 4, 2004 <---------------Advertisement---------------> DICE.COM Access over 20,000 targeted technology job postings. Register on Dice.com today! Dice.com is the leading online technology job board. Whether you are seeking permanent or contract employment, Dice.com provides the tools that will get you results. http://ct.com.com/click?q=65-K8OzIDPaMgyrRKwuCVUDeVzQE9eA <-------------------------------------------> SEE WHAT'S NEW IN THE JAVA 1.5.0 BETA RELEASE Sun has released a beta version of Java 1.5. Even though many shops will not be moving to the latest version of Java for quite some time, it's never too early to start planning. This tip highlights some of the more important changes in Java 1.5 and will hopefully convince you that the new version is worth taking out for a spin--if only to get an idea of what it can do. Java 1.5 contains lots of new features and changes that will affect Java users across the board; but, from a programmer's perspective, Java 1.5 is a programmer's release. Here are some of the new features and enhancements that are important to programmers. ENUM SUPPORT Enumerators have been missing from Java since the beginning. Programmers no longer have to use workarounds to get typesafe enumerators. AUTOBOXING/UNBOXING When calling a method that takes an int as an argument, you won't have to do this: takesInt(someInteger.intValue()). Instead, the compiler will do it for you. GENERICS By far, the most hyped feature of the language is generics. In a nutshell, generics will allow you to use typesafe collections. This is advantageous because you'll get ClassCastExceptions at compile time instead of runtime. A NEW FOR LOOP Sun calls it the enhanced for loop. The enhancement is that the for loop now works with collections and arrays naturally. for ( Object o : someCollection ) { System.out.println(o); } for ( String s : someStringArray ) { System.out.println(s); } VARIABLE ARGUMENT LISTS Methods may now accept a variable number of arguments. This is achieved by declaring the method with ellipsis notation (three dots) between the type and argument name, like this: static void flexible(String ... names). SYSTEM.OUT.PRINTF You can use printf-like formatting to create console output and strings just like your C-coder companeros. The class that gets the work done is Formatter, which has a complementary class called Scanner that can parse strings using regular expressions. There are too many new features to list here, but upcomging tips will go into further detail about specific features. To find out about all the new features in Java 1.5, install it and take a look, or visit Sun's site and peruse the online documentation for Java 1.5. http://java.sun.com/j2se/1.5.0/docs/index.html David Petersheim is the Director of Application Development with Genscape, Inc. He designs and develops server-side applications to acquire and process real-time energy data. ----------------------------------------