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

what if a runtime exception happen inside a finalize method

 
harilal ithikkat
Ranch Hand
Posts: 221
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What will happen if a runtime exception happen inside finalize method.

options are
a) application will break down
b) the object in finalize method will be released
c) the object will not be released
d) none of these
 
fred rosenberger
lowercase baba
Bartender
Posts: 12196
35
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this looks like a question from some test or book. We require you quote your source for anything you post here if it is not your original work.

thanks
 
harilal ithikkat
Ranch Hand
Posts: 221
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
dear friend...i got it from a question paper..of a recruitment exam..
i do remember the question paper series..QF1 and i think its not a good thing to say the company name


 
Nitish Bangera
Ranch Hand
Posts: 537
Eclipse IDE Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
well basically if you speak of finalize means the program created everything properly and JVM ran properly without exceptions. Also finalize is run for a object. So what type of object are they talking and reassigning it to a reference variable so that its not eligible for GC won't throw and exception. Basically i think there won't be any exceptions in a finalize. But if there are any exceptions is thrown then it will halt the finalization process that's all. Application won't break down. C is the appropriate answer here. Object won't be gc'd but is still elligible for GC. But next time it will be gc'd as finalize on the object just runs once.
 
harilal ithikkat
Ranch Hand
Posts: 221
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Nitish ...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic