First Look at class, ordinary non-generic class.
Note: class is a Java keyword that is used when declaring a Java class;
Instances of class classes represent Java Application Runtime classes (class ans enum) or interfaces (interface and annotation) (each Java class runtime behaves as a class object in the JVM, which can be passed the class name. Class, Type. GetClass (), Class.forName ("Class name"), and other methods to get the class object). Arrays are also mapped to classes of class objects, and all arrays that have the same element type and number of dimensions share the class object. The base type boolean,byte,char,short,int,long,float,double and the keyword Void are also represented as Class objects.
T Bean;
Class<t> Bean;
Class<?> Bean;
In the use of reflection to obtain properties, encountered such a writing, specifically to look for some information to study a bit.
The individual T represents a type and class<t> and class<?> represent the class for which the type corresponds
Class<t> when instantiating, T should be replaced by a specific class
Class<?> is it a wildcard generic,? can represent any type
<? Extends T> Limited wildcard, which represents an unknown subclass of T.
<? Super T> lower bound wildcard, which represents an unknown parent class for T.
Public T Find (class<t> clazz, int id);
An instance is generated from a class to reflect it, and it is not possible to do so alone with T.
The object class contains a method called GetClass, which allows you to obtain an instance of the type class. A type class refers to a class that represents a type, because everything is an object, and the type is no exception, and in Java the Type class is used to represent a type. All type classes are instances of class classes. GetClass () will see the return class<?>.
In the JDK, the definition of the normal class.newinstance () method returns object, which is to be cast to another type;
However, the Class<t>,class.newinstance () method using generics has a specific return type;