Android initial stage of learning, final,finally,finalize is differentiated:

Source: Internet
Author: User
Final: Used to declare properties, methods, and classes. The modification is the basic type, which means that the value given by the variable is immutable, that is, it is a constant, and the final decorated method cannot be overridden by subclasses, but does not affect the inheritance of the subclass; The final decorated class cannot be inherited.
Finally: This statement is always executed in the try-catch-finally statement, regardless of whether there is an exception or no exception.
Finalize: This method is a method in the object class (all classes have this method) and is part of the GC (garbage Collertor) run mechanism, which is called when the GC cleans up its subordinate objects, and throws an uncaught exception if it is executed. The GC terminates cleanup of the object, and the exception is ignored, knowing that the next time the GC starts cleaning up the object, its finalize () will be called again, calling them to simply recommend that the GC start and clean up the unused objects to free up memory space, but the GC's start-up is not certain. This is determined by the Java virtual machine, knowing that the Java virtual machine is stopped.


Android initial stage of learning, final,finally,finalize is differentiated:

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.