Java Learning note--java object creation, initialization, reference parsing

Source: Internet
Author: User
Tags null null

If there is a Class A.

1. For example, the following expression:

A a1 = new A ();

So a is a class, A1 is a reference. New A () is an object. Just A1 this reference points to the object of New A ().


2, also such as:

A A2;

A represents a class, A2 is simply a reference, and only the object that the A2 points to is null null.


3, again such as:

a2 = A1;

It represents the A2 is a reference, A1 is also a reference, in this process A1 the address of the object to the A2, making A2. A1 points to the same object.


4. References

As in the following code snippet:

int k; Base data type

A; Reference data type

A = new A ();//Class A as a template in the heap of space to create a Class A object, also known as the initialization of the object

b b1,b2,,,, bn;//assumes that B is an abstract class or interface


Java Learning note--java object creation, initialization, reference parsing

Related Article

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.