download

Get the code
Download the source code for examples in this Java 101 tutorial. Created by Jeff Friesen for JavaWorld.

What are generics?

Generics are a collection of related language features that allow types or methods to operate on objects of various types while providing compile-time type safety. Generics features address the problem of java.lang.ClassCastExceptions being thrown at runtime, which are the result of code that is not type safe (i.e., casting objects from their current types to incompatible types).

To read this article in full, please click here