Java class initialization and instantiation summary

Source: Internet
Author: User
Refer to the public number Java leader in-depth understanding of Java object Creation process original blog.csdn.net/justloveyou_/article/details/72466416Java object creation Process: 1. Class loading process

Preparation stage: Loads the compiled. class file into memory, allocates memory for class variables (static class member variables), and sets the class variable initial value (0 value) stage.

Initialization phase: Is the process of actually starting to execute the Java program defined in the class and initializing the class variable as the program ape intends.

2. class instance loading process

Prep phase: Allocates memory for class instance variables and is given the default value (0 value).

Initialization stage: For the class instance variable according to the program ape intention to initialize the value, can be divided into class instance variable initialization, class instance code block initialization and constructor initialization.

3. In general, the general process of class instantiation is the constructor of the class constructor for the parent class constructor <clinit> (), the subclass constructors <clinit> (), the parent class, and the instance code block, the parent class. Constructors for child classes, member variables and instance code blocks, subclasses

Java class initialization and instantiation summary

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.