BTC USD 77,508.4 Gold USD 4,393.66
Time now: Jun 1, 12:00 AM

what are the differences between final,finally,finalize methods?

christainpaul

Freshie
Messages
4
Joined
Mar 4, 2010
Messages
4
Reaction score
0
Points
3
final is used for making a class no-subclassable, and making a member variable as a constant which cannot be modified.finally is usually used to release all the resources utilized inside the try block. All the resources present in the finalize method will be garbage collected whenever GC is called. Though finally and finalize seem to be or a similar task there is an interesting difference here.This is because the code in finally block is guaranteed of execution irrespective of occurrence of exception, while execution of finalize is not guarenteed.finalize metod is called by the garbage collector on an object when the garbage collector determines that there are no more references to the object.
 
Back
Top
Log in Register