A. Difference
The individual T represents a type, and class<t> represents the class corresponding to that type, class< > classes that represent types that are indeterminate
EElement (used in the collection because the element is stored in the collection) T-type (Java Class) K-Key (key) V-Value (values) N-number (numeric type)? -represents an example of an indeterminate Java type: Set<T>represents an instance of the T class in the collection List<E>represents an instance of Class E in the collection List<?>indicates that the object type in the collection is undefined, and the list is not specified<?>is the same. The role of generics:1, Generic: Java Code collection code list<T> list=NewArraylist<t>(); T T=list.get (0); 2, no generics: Java Code Collection code list List=NewArrayList (); T T= (T) list.get (0);
second, how to create an instance of the class<t> type?
Just like using non-generic code, there are two ways to call the method Class.forName () or use the class constant X.class. Class.forName () is defined to return class<?>. On the other hand, the class constant x.class is defined as having type class<x>, so String.class is the class<string> type.
Generics class<t>, T, and class<?> in Java