Tutorial by Topics: generics

Generics are a facility of generic programming that extend Java's type system to allow a type or method to operate on objects of various types while providing compile-time type safety. In particular, the Java collections framework supports generics to specify the type of objects stored in a collection instance.

A List can hold numbers, words or really anything. That's why we call the List generic.

Generics are basically used to define which types a class can hold and which type an object currently holds.

Page 1 of 1