Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Garbage collection

 
Shafeeq Sheikh
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which book said RuntimeException is same as System.exit?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic