JavaSE_ insist on reading source code _Class object _Java1.7

When a Java program is running, the Java runtime system always performs so-called runtime type identification on all objects. This information records the class to which each object belongs. The virtual machine usually uses the runtime type information to select the correct method to execute. The class used to store this type information is the Class class. The Class class encapsulates the runtime state of an object and an interface. When a class is loaded, an object of type Class is automatically created . ------> This is to be verified, I haven't found the code to explain this

Class has no public constructor. Class objects are automatically constructed by the Java virtual machine when the class is loaded and by calling the defineClass method in the class loader, so you cannot explicitly declare a Class object.

The virtual machine manages a unique Class object for each type. That is, each class (type) has a Class object. When running a program, the Java Virtual Machine (JVM) first checks whether the Class object corresponding to the class to be loaded has been loaded. If it is not loaded, the JVM will look for the .class file based on the class name and load its Class object.

Basic Java types (boolean, byte, char, short, int, long, float, and double) and the keyword void also correspond to a Class object. ------> What is it?

Each array belongs to a class that is mapped as a Class object that is shared by all arrays with the same element type and dimension.

Generally, a Class object of a class is loaded into memory, and it is used to create all objects of this class.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325903862&siteId=291194637