This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Exception in garbage collection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Exception in garbage collection" Watch "Exception in garbage collection" New topic
Author

Exception in garbage collection

Michael Lin
Ranch Hand

Joined: Dec 04, 2000
Posts: 31
Question 78.
If a Runtime Exception is thrown in the finalize method -

1.The running application crashes.
2.The exception is simply ignored and the object is garbage collected.
3.The exception is simply ignored, but the object is not garbage collected.
4.The Exception causes the JVM to crash.

the answer is 2,
but I think should be 3, reading from the api.
can someone please correct this??
dheeraj chopra
Greenhorn

Joined: Jan 12, 2001
Posts: 2
option 2


dheeraj
vadiraj vd
Ranch Hand

Joined: Dec 15, 2000
Posts: 68
Yes Michael the answer is 2.
The GC will catch any exception that have generated in finalize()
but ignores them. If the GC wants to garbage collect the current
object then it will gabage collect it.
Refer Khalid about this. page no. 256 q8.3.


------------------
Regards
---------
vadiraj

*****************
There's a lot of I in J.
*****************


Regards<BR>---------<BR>vadiraj<P><BR>*****************<BR>There's a lot of I in J.<BR>*****************
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Exception in garbage collection
 
Similar Threads
finalize!
Garbage collection
If a Runtime Exception is thrown in the finalize method -
another question regarding garbage collection
Q on finalize() method