105. Migrating to Java 5 Version 5.0 This course shows Java-1.4 developers the new language features in Java 5, and, more importantly, illustrates best programming practices as they've been affected by these new features. This is an accelerated course that assumes long experience with earlier versions of Java. Students will leave familiar with various new bits of Java-5 syntax, and also with an understanding of the exciting new options they have for API design and general-purpose Java coding. Prerequisites * Plenty of experience with Java programming using the 1.4 SDK is essential. Learning Objectives * Take advantage of ease-of-use features including the simplified for loop, auto-boxing, and varargs. * Use and develop enumerated types, including those with their own state and inherent behavior. * Use generics effectively when coding to the Collections API. * Develop one's own generic types. * Use Java annotations as defined by other APIs, and develop one's own. * Understand issues of compatibility and migration in mixed 1.4/5 environments. Timeline: 1.5 days. IDE Support: Eclipse Galileo In addition to the primary lab files, an optional overlay is available that adds support for Eclipse Galileo. Students can perform all coding, testing, and debugging tasks from within the IDE. See also our orientation to Using Capstone's Eclipse Overlays, and please be advised that this is an optional feature; it is not a separate version of the course, and the course itself does not contain explicit Eclipse-specific lab instructions. Chapter 1. Ease-of-Use Features Goals of Java 5 Simplified for Loop Variable Parameter Lists Formatted Output Static Imports Chapter 2. Enumerated Types Native Enumerations Ordinal and String Representations Looping Over Enums Stateful and Behavioral Enumerations Chapter 3. Generics Using Generics Generics in the Collections API Developing Generic Classes Auto-Boxing Convertability of Generics Wildcards Type Erasure Generic Methods What You Can't Do Strong and Weak Suits Chapter 4. Annotations Annotations Aspect-Oriented Programming Native Annotations The Java Annotations Model What Can Be Annotated Annotations vs. Descriptors Java EE Annotation Examples Chapter 5. Compatibility and Migration Compatibility: Compiler and Runtime Mixing 1.4 and 5 Classes Compatibility with Generics: Type Erasure Compatibility with Enumerations and Varargs Migrating 1.4 Code to Java 5 Runtime Type Safety with "Checked" Collections System Requirements Hardware, Minimum: 500 MHz, 256 meg RAM, 500 meg disk space. Hardware, Recommended: 1.5 GHz, 512 meg RAM, 1 gig disk space. Operating System: Tested on Windows XP Professional. Course software should be viable on all systems which support a J2SE 5.0 JDK. Network and Security: Limited privileges required -- please see our standard security requirements at http://capcourse.com/Guides/Security.gen.html. Software Requirements: All free downloadable tools.