Difference between final, finally, and finalize
Basis Final Finally Finalize
1. Type It is a keyword. It is a block. It is a method.
The final keyword is used in
Java in order to restrict class,
variable, and method. When
the final keyword is used in a
The finalize method is used
class, it restricts the class from
The finally block is used in in Java in order to carry out
being inherited and it restricts
Java in order to execute the cleanup process just
2. Function the variable from being
codes whether the exception before the garbage
modified in the case in which it
has been managed or not. collection operation is run
is used with a variable.
on an object.
Similarly, when the final
keyword is used with a
method, it restricts the method
from being overridden.