+ 2

Use of final, finally, finalise ? With difference between them.

25th Mar 2018, 6:24 PM
Ruchit Porwal
Ruchit Porwal - avatar
3 Respuestas
+ 8
FINAL: Final 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: Finally is used to place important code, it will be executed whether exception is handled or not. Finally is a block. FINALIZE: Finalize is used to perform clean up processing just before object is garbage collected. Finalize is a method.
25th Mar 2018, 6:45 PM
Baraa AB
Baraa AB - avatar
+ 1
Difference between final, finally and finalize.... final - is a modifier which applicable for classes, variables and methods. if we use final modifier with the class that's mean we can't create child class. if we use final modifier with method that means we can't override method in child class. if we use final modifier with the variable that means we can't modify or re- assignment of variable. finally- is a blocked which is always associated with the try catch to maintain the clean-up activity. finalize - is a method which is present in object class. finalize method always invoked by Grabage Collector just before destroying the object for clean-up activity.
21st Jan 2020, 3:13 AM
P∆WAN M∆URY∆
P∆WAN M∆URY∆ - avatar