Java Construction Method & Finalize Method

Source: Internet
Author: User

1. The constructor method is a class method with the same name as the class.

2, the construction method belongs to the class, does not belong to any object, cannot be called by the object reference created by the class.

3. After creating an object with the New keyword and opening up memory for the object, the Java system will automatically invoke the constructor method to initialize the new object.

4. The construction method does not return a value type, and if the corresponding type is specified, the method is not a construction method.

5, when constructing the class can not write the construction method, the system will automatically add a default empty construction method for the class.

6, when the parameter name in the constructor method is the same as the domain variable name, the This keyword is used in the construction method to distinguish the parameter name from the domain variable name.

7, the structure method has polymorphism

Java Construction Method & Finalize Method

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.