JavaBeat
calling cards | international calling cards | phone card
SCJP 5.0 HOME | New to SCJP? | Objectives | Articles | Mock Exams | Tutorials | Resources | Forums | SiteMap&Links

Join Our Mailing List
Email:

Page 1 of 7 articles
UseFul Links
JavaBeat Search
JavaBeat Blogs
SCWCD Mocks
SCJP 5.0 Mocks
AJAX Articles
JavaBeat Forums
Struts Articles
Spring Articles
JSF Articles
Hibernate Articles
Sponsors
Java 5.0 annotations
I've finally got around to looking at some of the new features in Java 5.0. When Java 5.0 first came out, it seemed like the new features were mostly Java (ironically) catching up with C#. (BTW - my background includes several years of Java, then some C#, then some more Java, then some more C# and currently Java again).
Java Generics and Collections: Evolution, Not Revolution, Part 2
Editor's Note: In last week's excerpt from Chapter 5 of Java Generics and Collections, authors Maurice Naftalin and Philip Wadler considered the situation of having a code-base that doesn't use generics, and how you can migrate to generics without having to cut completely over in one release. They portray the situation with simple examples of "library" and "client" code, and then consider the migration of the library to generics while leaving the client non-genericized. In this second part of the excerpt, they move on to the trickier case: genericizing the client, while leaving the library alone.
Nuances of the Java 5.0 for-each Loop
This article is an in-depth examination of one of the simplest but most pleasing features in Java 5.0--the for-each loop. I present eleven short items discussing various nuances of usage, pitfalls to be aware of, and possible optimizations surrounding the use of the for-each loop. In the first section, I discuss what kind of iterations are possible with the for-each. The next section illustrates common programming errors in using the for-each loop. The final section shows how to write new classes that can be used as targets of a for-each loop. I also talk about advanced implementations that allow multiple iterable views; lazily construct objects just in time for iteration; and enable possible generic algorithm and compiler optimizations of the for-each loop.
Enhance looping in Java 5.0 with for/in
The for/in loop -- often called either enhanced for or foreach is largely a convenience feature in Java 5.0. It doesn't really offer any new functionality, but certainly makes several routine coding tasks simpler. In this article, you'll learn about many of those, including using for/in to iterator over arrays and collections, as well as how it can help avoid unnecessary (or just plain annoying) typecasts. You'll also learn how for/in is implemented, glean details about the new Iterable interface, and even understand how to make your own custom objects usable with this new construct. Finally, you'll learn about the things that for/in can't do to make sure you understand when plain old for is the right choice.
Learn to Use the New Annotation Feature of Java 5.0
The new Java 2 Platform Standard Edition 5.0 (the developer version number is 1.5 and the code name is "Tiger") provides many new features, among them is the ability to annotate Java program elements and to create custom annotation types. Development and deployment tools can then read annotated data (also known as metadata) and process it in some fashion.
Generics in J2SE 5.0
Generics are the most important feature in J2SE 5.0. They enable you to write a type (a class or an interface) and create an instance of it by passing a reference type or reference types. The instance will then be restricted to only working with the type(s). For instance, the java.util.List interface in Java 5 has been made generic. When creating a List object, you pass a Java type to it and produce a List instance that can only work with objects of that type. That is, if you pass String, the List instance can only hold String objects; if you pass Integer, the instance can only store Integer objects. In addition to parameterized types, you can create parameterized methods, too.
Taming Tiger: Are you SCJP 5 certified?
In April 2005, Sun updated its certification for J2SE 5. If you're interested in getting certified, or updating your current certification, this article provides a quick-and-dirty overview of the skills you'll need.


JavaBeat 2006, India | javabeat home | About Us | partners directory | Advertise with us