final: used when declaring a global variable, meaning that the variable cannot be modified , cannot beoverridden, is generally used to declare a constant, or the value of a system setting, a class that is decorated with it Cannot be inherited .
Example: publicstatic final String a = "123"
This means: public (all scopes visible), static (only one in the system), final (immutable) variable A, value 123
finally: used in the try-catch-finally block, the function is, whether the code executes a try or catch, will eventually execute the code in finally
Example:
try{
Here are some code that might appear to be abnormal
}catch (Exception e) {
Execute the code here if an exception occurs. Otherwise, do not execute
}finally{
regardless of whether there is an exception, execute the code here
}
Finalize: Summons the garbage Collector command, and once you use this method, the system will schedule a garbage collection
However, it is not immediately executed, and the point of execution is not deterministic.
It is not necessary to use Finalize () in the absence of special requirements, and it is good for the GC to manage itself.
The difference between Java->final, finally, finalize