In Java an identifier can be declared to represent a variable whose possible value is a type!
Such identifiers are called generic parameters.
An identifier must be declared to be a generic identifier.
Below line 2 declares E to be a generic parameter. The scope of E is from line 2 to the end of the class MyList at line 11.
Line 6 is a use of E, not a declaration of E.
If one or more generic parameters is declared in a class header (line 2), the class is said to be a generic class.
1 2 public class MyList<E> // declaration of E 3 { 4 5 ... 6 public void add(E x) // Use of E 7 { 8 9 } 10 11 }