File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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 Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "finalize!" Watch "finalize!" New topic


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.
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="" target="_blank" rel="nofollow">My Blog</a>
I agree. Here's the link:
subject: finalize!
It's not a secret anymore!