0

What is difference between final, finally, finalize in java?

8th Feb 2020, 5:49 AM
ASIYA SHAIKH
ASIYA SHAIKH - avatar
2 Respostas
8th Feb 2020, 7:17 AM
A͢J
A͢J - avatar
+ 1
final before a varible make it constant. Ex: final int size=10; //so later you cannot modify its value... final before a method, makes it not possible to overwrite in sub class... Final before a class prevents it inheriting.. finally is used in Exception handling.. try{..}catch{..}finally{..} Finally block always gets executed whether Exception is raised or not.. finalize() is a method used in garbage collection.. Garbage collection is taken care by the jvm.... Hoping it helps you some... Edit: Above link providing more clarity...
8th Feb 2020, 7:21 AM
Jayakrishna 🇮🇳