In-depth understanding of Java virtual machines, class loading

Source: Internet
Author: User

1, by using a static field, only the class that really defines the field is initialized, (the subclass is not initialized, the parent class initializes the

2,new Array, not initialized

3, through the class to invoke some of the constants of the class, you can not initialize the class, (constant at compile time, is optimized to the Notinitialization class, became his reference, so you can not initialize

4, the class and interface initialization requirements are different, the interface can not initialize the interface of the parent class

5, Loading:

1) Get a binary byte stream of a class by the fully qualified name of a class

2) Transfer the static storage structure of this class to the runtime data structure of the method area (run the constant-rate pool?).

3) Initialize a class object in Java.lang.Object as the entrance to the method area

6, Verification: important is not necessary

1) class file format verification

2) meta-data test, whether there is a parent class, final

3) Byte code verification, method body inside the operation

4) Verification of symbolic references

7, prepare: member variable 0 value (except final

8, Parse: Character reference-"direct reference"

1) Character reference: independent of memory distribution, all reference targets do not necessarily load into memory

2) Direct reference: translated by a character reference, with a direct memory address

9, initialization, explicit member variable assignment

10, class and ClassLoader, only the same class loader is the same class

In-depth understanding of Java virtual machines, class loading

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.