permaculture playing cards
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes GC Doubt Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "GC Doubt" Watch "GC Doubt" New topic

GC Doubt

vidya sagar
Ranch Hand

Joined: Mar 02, 2005
Posts: 580
Whether it is True or False

If an exception is thrown during execution of the finalize method of an object,then the exception is ignored and the object is destroyed.

If it is true..............

(i taught)Jvm while executing in the middle of finalize method, if any exception raises, then it is ignored and object is not collected by GC at this time.

If it is false..........

then what is result???

Correct me what is answer to statement.......along with why??
Joe Sondow
Ranch Hand

Joined: Apr 10, 2005
Posts: 195

If the finalize method throws an exception, the exception will be ignored. There is one unusual case in which the object will not then be destroyed, but in general the object will be destroyed, because the garbage collector called finalize before destroying the object.

The unusual case is when the finalize method stores a reference to the current object in some other container that is not eligible for garbage collection, thereby making the current object NO LONGER ELIGIBLE for garbage collection, even though it was about to be garbage collected.

Anyone disagree?

SCJA 1.0 (98%), SCJP 1.4 (98%)
vidya sagar
Ranch Hand

Joined: Mar 02, 2005
Posts: 580
Can any one jusify Joe statement i am looking for javagurus reply
I agree. Here's the link:
subject: GC Doubt
jQuery in Action, 3rd edition