Difference between Final, Finally and Finalize in java

Difference between Final, Finally and Finalize in Java

Final

  • It is used to apply restrictions on class, method and variable. Final class can't be inherited, final method can't be overridden and final variable value can't be changed.
  • Final is a keyword.

Finally

  • It is used to place important code, it will be executed whether exception is handled or not.
  • Finally is a block.

Finalize

  • It is used to perform clean up processing just before object is garbage collected.
  • Finalize is a method.
Posted on by