Java: Instantiation (instantiation) detailed

Source: Internet
Author: User

class contains a template for creating objects, including properties and behavior;

Instantiation is the process of creating objects based on the definition of class; The object is the property of the Fill class, and the generated instance;

Encapsulation: Binding the state and behavior of an object to a logical unit;

In Java, a declaration is the creation of a reference to an object, the entity that creates the object, and the keyword "new" is used;

Java references, unlike the c\c++ pointers, are representations of reference objects, but cannot perform arithmetic operations;

The assignment operation of an object reference in Java is a passed handle (handle), not a copy, but a point to the same object;

Releases the handle using the keyword "null";

Garbage collection, the JVM (Java Virtual machine) will automatically recycle the objects released;

You can request garbage collection by using the statement: Runtime.getruntime (). GC ().

An object can also be an object's property, in which it simply stores the object's handle and does not retain the entire copy, avoiding data redundancy.

Author: csdn Blog spike_king

More Wonderful content: http://www.bianceng.cnhttp://www.bianceng.cn/Programming/Java/

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.