Mega Code Archive

 
Categories / Java Book / 001 Language Basics
 

0120 Type Parameters Cant Be Instantiated

It is not possible to create an instance of a type parameter. For example, consider this class: // Can't create an instance of T. class Gen<T> { T ob; Gen() { ob = new T(); // Illegal!!! } }