my dog learned polymorphism*
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
Author

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
True

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
 
GeeCON Prague 2014
 
subject: GC Doubt