The object class is the parent class of all classes, arrays, and enumeration classes, and is the root class of the class hierarchy. Each class uses object as a superclass. All objects, including
arrays) Implement this class of methods.
The object class implements the following methods:
Let's take a look at the source code in the GetClass () method:
Public final native class<?> GetClass ();
The function of the class<?> getclass () method above is to return the runtime class of the object.
Refer to the following procedure for specific use:
Class Work{}public class Main {public static void main (string[] args) {class clazz1= "class". GetClass (); System.out.println (CLAZZ1); Class clazz2=new Integer ("123"). GetClass (); System.out.println (CLAZZ2); Class clazz3=new work (). GetClass (); System.out.println (CLAZZ3);}}
Output Result:
Class Java.lang.String
Class Java.lang.Integer
Class Code2. Work
Once we have the class object corresponding to one of the classes, we can call the class object's method to get the object and the real information of that class. About
The use of class, which is described later in the reflection.
Reprint Please specify source:http://blog.csdn.net/hai_qing_xu_kong/article/details/43899035 Emotional Control _
Java Learning Note 12