GeeksforGeeks » Interview Questions
Amazon Interview Question for Software Engineer/Developer (2-5 Years) about Terminology
(4 posts)-
describe the difference between final, finally and finalize in java
-
final --> constant
finally --> the last block which gets executed before termination
finalize --> method is called by the garbage collector when it determines no more references to the object exist -
finally is last block witch catches all exceptions during exception handling.
-
Final class - > can't be extended
Final variable -> the value can't be changed
Final method ->can't be overridden
Finalize is called up the Garbage Collector to destroy the object.(Can be called within the code even but doesn't guarantees the destruction of code)
Finally -> Block which handles cleanup code(generally) after a try/catch block has been exectud
Reply
You must log in to post.