Object instantiation of Java Learning

Source: Internet
Author: User

An Object instantiation process:
Person p = new person ();
1,JVM reads the Person.class file under the specified path, loads it into memory, and loads the person's parent class first, if there is a direct parent class.
2. Open space in heap memory, assign address.
3, and in object space, the default initialization of the properties in the object (the base type assigns the initial value).
4, the corresponding constructor is called to initialize.
5, in the constructor, the first row is initialized by calling the constructor in the parent class first.
6, when the parent class is initialized, the properties of the child class are displayed for initialization.
7, in the specific initialization of the subclass constructor.
8, the address value is assigned to the reference variable when the initialization is complete.

Object instantiation of Java Learning

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.