Start of Tutorial > Start of Trail > Start of Lesson |
Search
Feedback Form |
In summary, using generic types or methods is not difficult once you've become used to the syntax. Here are a few important points to remember when using generics:
- Generics add compile-time type checking to the Java language allowing the compiler to catch mismatched types at compile time, instead of when a
ClassCastException
is thrown at runtime.
- When using a generic type, replace the single letter between the angle brackets, (for example: <E>), with an actual type (for example: <String>).
- Use the
-Xlink:unchecked
to get the most information from the compiler about unchecked or type unsafe operations.This section discusses how to use generic types and methods. For information on how to write a generic type or method, see Generics by Gilad Bracha.
Start of Tutorial > Start of Trail > Start of Lesson |
Search
Feedback Form |
Copyright 1995-2005 Sun Microsystems, Inc. All rights reserved.