aspose file tools
The moose likes Java in General and the fly likes Garbage collection Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "Garbage collection" Watch "Garbage collection" New topic
Author

Garbage collection

Saurabh V Vakil
Greenhorn

Joined: Jan 30, 2008
Posts: 14
In case of inheritance, if the child class instance is garbage collected, then will the finalize method of the base class be called?
Daesung Park
Ranch Hand

Joined: Mar 22, 2007
Posts: 68
Yes, it is called if subclass didn't override it.


Daesung Park

BLOG
Peter Chase
Ranch Hand

Joined: Oct 30, 2001
Posts: 1970
In other words, finalize() is an ordinary overridable method. So, if the subclass has a version of finalize(), then the superclass version will only be called if the subclass version calls super.finalize(). Normally, it should do so.

Of course, discussion of finalize() is of little more than academic interest, as there are very few worthwhile uses of finalisation.


Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.<br /> <br />#:^P
Saurabh V Vakil
Greenhorn

Joined: Jan 30, 2008
Posts: 14
Thanks for your replies guys!!!
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Garbage collection
 
Similar Threads
garbage collection problem
GC and static variable.
another finalize doubt
WA #1.....word association
string question