here to get updates on new
1. Difference between final, finally, finalize?
1. Final is a modifier applicable
for classes methods and variables. If a class declared as
final then we can't extend that class. i.e we can't create
child class for that class.
2. If a method declared as final then we can't override
that method in the child class.
3. If a varaiable declared as final then it will become
constant and we can't perform re-assignment for that variable.
- finally is a block
always associated with try catch to maintain cleanup
// risky code…
catch( X e)
- finalize() is a method
which is always invoked by garbage collector just before
destroying an object to perform cleanup activities.
- finally meant for
cleanup activities related to try block. where as finalize()
meant for cleanup activities related to object.