The class fully qualified name is java.lang.Class
The class class object stores the classes ' fully qualified name, attributes, methods, and parent classes of the other class.
Suppose a class A is defined,
When creating a Class A object, you also create an object of class.
AA();
When creating a Class (a) object, the Java platform automatically creates a class object for the object (note that the class object entity is not assigned to a class class reference) and the class object stores some information that describes class A. Then you can use this information in your code to judge.
Because the class object entity is not assigned to a class reference that is available to our program, use the GetClass () method provided by the object class to return the class class instance for the object entity of type A, and then assign the value to the class reference.
1, you can do the following
class =a1.getClass();
2. Then call the method provided by Class GetName ();
Stringclass.getName();
This returns the fully qualified name of the Class A, which is known to call this method.
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
A Practical class