Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Finalize Drag and Drop - thoughts?

Jeff Levine
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Everyone,

Thoughts on the following OCPJP 5 mock exam question (Whizlabs practice test)?

The finalize method...
a) May or may not be called just before garbage collection happens.
b) Can be used to resurrect an object.

The correct answer is B, which I understand.
I chose option A, because the finalize method is only called once - if the object is resurrected, it will not be called before GC is called a second time.

Do both answers seem correct? If not, why isn't A correct?

Jeanne Boyarsky
author & internet detective
Posts: 34095
Eclipse IDE Java VI Editor
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic