Java features explained with examples

Posts tagged generics

Generics erasure

The use of Generics allows a type or method to operate on objects of different┬átypes while providing compile-time type safety. However, the JVM knows nothing about type parameters or generics as the compiler erases type parameters when creating bytecode. According to, type erasure aim is “Type erasure ensures that no new classes are created […]