This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes finalize! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "finalize!" Watch "finalize!" New topic
Author

finalize!

ashok khetan
Ranch Hand

Joined: Jul 29, 2001
Posts: 153
If a Runtime Exception is thrown in the finalize method -

a) The running application crashes.
b) The exception is simply ignored and the object is garbage collected.
c) The exception is simply ignored, but the object is not garbage collected.
4) The Exception causes the JVM to crash.
Select the correct answer.
Rashmi Tambe
Ranch Hand

Joined: Aug 07, 2001
Posts: 418
The correct answer is B.
Even if finalize method throws runtimeException , it is ignored and the object is garbage collected.
correct me if i am wrong.
Rashmi
Gagan Indus
Ranch Hand

Joined: Feb 28, 2001
Posts: 346
agree wid Rashmi
b) The exception is simply ignored and the object is garbage collected. ( but NOT immediately , remember )
( tho , think tht options culd hav been better-wordered )

------------------
Gagan (/^_^\)


Gagan (/^_^\) SCJP2 SCWCD IBM486 <br />Die-hard JavaMonk -- little Java a day, keeps you going.<br /><a href="http://www.objectfirst.com/blog" target="_blank" rel="nofollow">My Blog</a>
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: finalize!