Multiple choice technology programming languages

If there is an exception in finalize method, will the object be garbage collected?

  1. True

  2. False

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

If an exception is thrown in finalize(), the exception is ignored by the garbage collector. The object is still marked as finalized and WILL be garbage collected. The finalize method's failure doesn't prevent GC.