It is well known that Java has an object class, which is the root cause of all Java classes, which declares several methods:hashcode (), Equals (), Clone (), which should be rewritten in all Java classes. ToString (), GetClass (), and so on. where GetClass () returns a class object.
The class class is very special and inherits from object as the general classes, whose entities are used to express the classes and interfaces of the Java program runtime and to express the enum, array, primitive Java Types (Boolean, Byte, char, short, int, long, float, double) and keyword void.
When a class is loaded, or when the defineclass () of the Loader (class loader) is called by the JVM, the JVM automatically generates a Class object.
Java JDK Source code can see the construction method of the class is private, and annotated as: Constructor, only the Java Virtual machine creates class objects. Java only A virtual machine can create a class object. The class class contains many native methods, local methods, not implemented in Java, but implemented by C or C + +.
Class is the origin of reflection, and for any class you want to explore, you only have to create a class object for it, and then you can evoke more than 10 reflection APIs through the latter.
Java allows us to generate the corresponding class object for a class from multiple sources:
1. Use GetClass (); (Each class has this function)
2. Use of Class.getsuperclass ();
3. Using the static method Class.forName (); (most commonly used)
4. Using the. class syntax (class str = string.class)
5. Using the TYPE syntax of primitive wrapper classes (Class C1 = integer.type)
Java record -89-java.lang.class