wood burning stoves*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Garbage collection 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 "Garbage collection" Watch "Garbage collection" New topic
Author

Garbage collection

Shafeeq Sheikh
Ranch Hand

Joined: May 12, 2000
Posts: 68
Found this on a mock exam.....
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 given is 2. But I thought it would be 4.
The JVM exits when it encounters a call to System.exit(0), right??? The same would hold true if System.exit() was coded in the finalize() method. Then why isin't 4. true???
Thanks,
Shafeeq
rajsim
Ranch Hand

Joined: May 31, 2000
Posts: 116
Which book said RuntimeException is same as System.exit?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Garbage collection
 
Similar Threads
finalize!
Exception in garbage collection
If a Runtime Exception is thrown in the finalize method -
another question regarding garbage collection
Q on finalize() method