Java Program Execution Order

Source: Internet
Author: User

Tag: The parent class class constructs the HTTPS property www. GPO COM Instance members

  The Java program execution sequence is as follows:

1. Default values for all properties in a class (in a swoop)

2. Parent class static property initialization, static block, static method declaration (executed in order of occurrence)

3. Subclass static Property initialization, static block, static method declaration (executed in order of occurrence)
Above is (class loading process, no construction method involved)

4. Call the constructor method of the parent class,

First the non-static member of the parent class is initialized, the construction block, and the declaration of the normal method (executed in the order of occurrence)

Then the parent class constructs the method

5. Call the constructor method of the subclass,

First the non-static member initialization of the subclass, the construction block, the declaration of the ordinary method (executed in the order of occurrence)

Then the subclass constructs the method
which
1-3: Class loading process, no construction method involved
1-5: Instantiation process, involving construction methods

Reference article:
Https://www.cnblogs.com/greatfish/p/5771548.html

Java Program Execution Order

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.