Java, JVM class loading mechanism

Source: Internet
Author: User

The class loading mechanism of a virtual machine is that the JVM loads the data from the. class file into memory from the description class and verifies, parses, and initializes the data, eventually creating a Java type that can be used directly by the JVM.

Load, connect (validate, prepare, parse), initialize, use, uninstall. Where parsing can be placed after initialization.

Load:

First, based on the full name of the class (Com.example.test.class), gets the binary byte stream that defines this class

Second, analyze and transfer the binary bytes into the method area (information of storage class, final, static variable)

Third, produce Java.lang.class object

Verify:

File format, class is not abstract class, is there a parent class, whether the parent class is allowed to inherit (final) and so on

Get ready:

allocating memory for class variables and setting initial values (0)

Analytical:

Convert a symbol reference to a direct reference (memory directly to the target)

Initialization

Encountering new, reflection, subclass initialization initializes the parent class, which is the active reference of the main class where main () is initialized.

Initialization is the last step in class loading, assigning values to various variables according to the values set by the programmer.

Java, JVM class loading mechanism

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.