Trail: Learning the Java Language
Lesson: Generics (Updated)
Type Erasure
Home Page > Learning the Java Language > Generics (Updated)

Type Erasure

Generics were introduced to the Java language to provide tighter type checks at compile time and to support generic programming. To implement generics, the Java compiler applies type erasure to:

Type erasure ensures that no new classes are created for parameterized types; consequently, generics incur no runtime overhead.

Problems with the examples? Try Compiling and Running the Examples: FAQs.
Complaints? Compliments? Suggestions? Give us your feedback.

Previous page: Guidelines for Wildcard Use
Next page: Erasure of Generic Types - all specs in one place