The memory reference of Object Obj=new object ()

Source: Internet
Author: User

Object Obj=new object ();

A very simple code, but here is the design of the Java stack, Java heap, Java method to the three most important memory area between the association.

Suppose this code appears in the method body.

1.Object obj will be reflected in the local variable table of the Java stack, which is the definition of a local variable. is a reference type.

The 2.new Object () will be reflected in the Java heap. All instance data values for the object type are stored (the secondary memory is not fixed, because no one can determine the size of the object).

3. The program runs, the type information has been loaded into memory, the data is in the Java method area, including: type of the parent type, the implementation of the interface, the method contains the type information. New Object (), which establishes the object based on this information. You can see that this information is thread-shared.

The memory reference of Object Obj=new object ()

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.