Core Java - What is the difference between final, finally and finalize()?
final
- It is a modifier which can be applied to a
class, method or variable.
- It is not possible to inherit the final
class, override the final method and change the final variable.
finally
- It is an exception handling code section.
- It gets executed whether an exception is
raised or not by the try block code segment.
finalize()
- It is a method of Object class.
- It is executed by the JVM just before
garbage collecting object to give a final chance for resource releasing
activity.
No comments:
Post a Comment