What purpose does the keywords final, finally, and finalize fulfill?


  • Final keyword is used to apply restrictions on class(immutable), method(cannot override) and variable(constant).
  • Finally is a block that always executes when the try block exits even if an unexpected exception occurs.
  • Finalize is a method called to clean or release the resources by the Garbage Collector before destroying the object.
0 answers