Type Erasure
Trail: Learning the Java Language
Lesson: 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.

Previous page: Guidelines for Wildcard Use
Next page: Erasure of Generic Types