The 5.0 release of the Java Standard Edition (J2SE) adds a number of
major and minor new language features. This seminar explains all
new language features, including traps and pitfalls, and provides hands-on
labs for getting acquainted with the new syntax and programming techniques.
Java Generics
The most significant addition to the Java 5.0 programming language
are generic types and methods. In this tutorial, we will take an
in-depth look into the new language feature, how it will help us improve
our programs, how it is supposed to be used and where its limitations are.
More specifically, we will discuss the additions made to the language
itself (generic and parameterized types and generic methods), changes to
the platform libraries (generic collections and extended reflection) and
various challenging details of generics such as the properties of type
parameters (their bounds and their scope), generic methods and type parameters
inference, wildcards (their meaning and purpose), the translation of generics
into bytecode by means of type erasure, its impact on the Java type system,
and various, often perplexing side-effects of type erasure.
Enums, Autoboxing, etc.
Some smaller additions to the programming language comprise syntax
for enumeration types, an enhanced for-loop, static imports, autoboxing,
and variable argument lists.
Among them the enumerations type is probably the most widely used of
these minor new language features, because enumeration types are fairly
common in practice. An enumeration type represents a set of related symbolic
constants. Enumeration types in Java can be very powerful and flexible,
but come with a couple of pitfalls in conjunction with initialization of
static fields.
Annotations
Another novelty in Java 5.0 is the metadata facility that allows 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. Tools and frameworks, such as JUnit or
EJB, define and process annotations for various purposes, but annotations
can equally well be used for building self-made utilities based on annotations.
The tutorial discusses the language features for definition and use
of annotations and demonstrates their processing in a hands-on lab using
the annotation processor tool
apt
. |
|
Prerequisite Courses
and Skills:
|
Working knowledge of Java; in-depth experience
with Java not required. |
|
Duration:
|
2 days |
|
Exercises:
|
Workshops and hands-on labs |
This is a course for Java programmers who want to explore new language
features added to the Java programming language with release 5.0 of the
J2SE. The course is designed to build on existing expertise as Java programmers
and take your skills one step further. Prerequisite for these seminars
is at least 1 year of experience with Java or equivalent knowledge.
OBJECTIVES
|
Learn how to use generics effectively |
|
Know what to expect of Java generics |
|
Know how to use programm annotations |
|
Understand novel Java idioms |
The course is designed by Klaus Kreft & Angelika
Langer and backed by years of experience in teaching Java and C++
related topics and more than a decade of real-world experience in industrial
software development both in C++ and Java.
Angelika Langer is a freelance trainer/mentor
in the area of object-oriented software development in C++ and Java. She
is a recognized author and speaker at conferences worldwide and author
of the
Java Generics FAQ
.
Klaus Kreft is a senior consultant for more than
20 years and has served as the lead architect on several successful industry
projects. He has been working in C++ for many year and works in Java since
1995. He is a regular speaker at OO conferences in Germany.
Together they wrote columns for C+ Report and
C/C++ Users Journal, are authors of the book "Standard C++
IOStreams and Locales". They publish articles on C++ and Java topics
in various computer magazines worldwide, including the column "Effective
Java" in the German JavaSpektrum magazine.
|