New Features in Java 5
If you have used Java before and now want to upgrade your skills, you might be interested in learning the new features in
Java 5, all of which are covered in this book. If you are an absolute beginner, feel free to skip this section.
- Generics. Provides compile-time type safety while still allowing a type or method to operate on objects of various types.
- Enhanced for Loop. The for statement can now be used to iterate over an array and a collection.
- Autoboxing/unboxing. Automatic conversion of primitives to wrapper types and vice versa.
- Enum type. A new enumeration type in Java.
- Varargs. Allows a method to accept a variable number of arguments.
- Static import. Eliminates the need to qualify static members with class names.
- Annotations. A special type of interface used for annotating any program elements.