Java object creation process

1 First, according to the first use of the constructor or static method, find the path of the class and locate the file
2 Load the Class object statically initialized (static initialization is only initialized when the class is loaded)
3 Use new Objects to allocate memory space for the object on the heap
4 Initialize all instance fields (use default values)
5 Perform initialization at all instance field definitions
6 Execute constructor

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326648026&siteId=291194637