5.3.2. Class¶
5.3.2.1. Lifecycle¶
Overall, the life cycle of a class in Java is as follows: Loading -> [Linking: Verification -> Perparation -> Resolutin ] -> Initialization -> Use (Using) -> Unloading.
The loading process is divided into three steps:
Get the binary byte stream that defines this class by its fully qualified class name
Convert the static storage structure represented by the byte stream into the runtime data structure of the method area
Generate an
java.lang.Class
object as the access entry for various data of this class in the method area
The verification phase is mainly used to ensure that the byte stream of the Class file meets the requirements of the current virtual machine. It is divided into several steps:
Determine the file format: whether it
0xCAFEBABE
with and whether the major and minor version numbers are within the processing rangemetadata validation
Bytecode Verification
Symbolic reference verification