wood burning stoves 2.0*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Garbage Collection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Garbage Collection" Watch "Garbage Collection" New topic

Garbage Collection

majohnad majohnad

Joined: Jan 01, 2003
Posts: 24
Hi All,
is the below statement is right? if so how it is?
Any class that includes a finalize method should invoke its superclass' finalize method
Thanks inadvance

Jessica Sant

Joined: Oct 17, 2001
Posts: 4313

unlike constructors... finalize() methods are not implicitly chained. The thought behind "Any class that includes a finalize method should invoke its superclass' finalize method." Is to ensure that any actions done in the superclass's constructor should be undone by the superclass's finalize() method.
The superclass's constructor is imlicitly called, the superclass's finalize() method is not, so you should manually call it anytime you override the finalize() method.
Make sense? Did I explian that correctly? (It's a lil early, and my shower is still tryin to wake me up... dang day light savings thing...)

- Jess
Blog:KnitClimbJava | Twitter: jsant | Ravelry: wingedsheep
I agree. Here's the link: http://aspose.com/file-tools
subject: Garbage Collection
Similar Threads
why finalize() can't be defined as private?
Gc question
Finalization Method
difference between finally and finalize()