Final, finally, finalize

Source: Internet
Author: User

Very simple

Final: cannot be xxx

Finally: XXX

Finalize: indicates that xxx

 

Final

If a class is declared as final, it means that it cannot generate a new subclass and cannot be inherited as a parent class. Declare variables or methods as final to ensure that they are not changed during use. Variables declared as final must be declared with an initial value, which can only be read and cannot be modified in future references. Methods declared as final can only be used and cannot be overloaded.

 Finally

Finally-The Finally block is provided for troubleshooting to perform any cleanup operations. If an exception is thrown, the matched catch clause is executed, and the control enters the Finally block (if any ).

 Finalize

Finalize, Java technology allows the use of the finalize () method to clean up objects before the Garbage Collector clears them from the memory. This method is called by the garbage collector when it determines that this object is not referenced. It is defined in the object class, so all classes inherit it. Subclass overwrites the finalize () method to sort system resources or perform other cleanup tasks. The finalize () method is called before the Garbage Collector deletes an object.

 

I really want to raise a dog...

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.