What is final, finally and finalize ?
- Final is used to apply limitations on class, method and variable. Final variable value couldn’t be changed final method couldn’t be overridden and final class can’t be inherited.
- Final is a keyword.
- Once initialized value of variable cannot be changed.
- If we declare any variable as final, we can’t change its contents since it is final, and if we change it then we have the Compile Time Error.
- Finally is used to place significant code, whether exception is handled or not that time will be executed.
- Finally is a block.
- Finalize is using for the processing of clean up to be perform just before object is garbage collected.
- Finalize is a method.
- Once finalize method completes immediately Garbage Collector destroy that object.