The difference between final, finally and finalize in java
The difference is as follows:
final: Modifier (keyword), used to declare attributes, methods and classes, respectively indicating that attributes are immutable, methods cannot be overridden, and classes Not inheritable.
Therefore a class cannot be declared both abstract and final. Declare variables or methods as final to ensure that they will not be changed during use. Variables declared as final must be given an initial value when declared (lazy initialization can also be used), and can only be read in subsequent references and cannot be modified. Methods declared as final can also only be used and cannot be overloaded.
Java introductory teaching video recommendation: java learning video
finally: It is part of the exception handling statement structure, indicating that it is always executed.
finalize: It is a method of the Object class. Java technology allows the use of the finalize() method to do necessary cleanup work before the garbage collector clears the object from the memory. This method can be overridden to provide garbage collection. For other resource recycling, such as closing files, etc., the JVM does not guarantee that this method will always be called.
Recommended related articles and tutorials: Introduction to java language
The above is the detailed content of The difference between final, finally and finalize in java. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment
