Java program running process

Source: Internet
Author: User

 

When running Java, the first thing that happens is to try to access main () [a static method], so the loader starts to start and find the compilation code of the corresponding class (that is, the. Class file ). During the loading process, the loader notices that it has a basic class (that is, the meaning of the extends keyword), so it loads it. This process will occur no matter whether you are preparing to generate an object of that basic class.

If the base class contains another base class, the other base class is loaded immediately, and so on. Next, perform static initialization in the root base class, and then in the next category class, and so on. It is critical to ensure this order, because the initialization of the category class may depend on the correct initialization of the base class members.

In this case, all necessary classes have been loaded, so you can create objects. First, all basic data types in this object are set to their default values, and the object handle is set to null. Then, the basic class builder is called. In this case, the call is automatically performed. However, super can also be used to specify the builder for calling from the row. The construction of the basic class adopts the same processing process as the pipeline class builder. After the basic builder is complete, the instance variables are initialized in the original order. Finally, execute the remaining body parts of the builder.

 

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.