94.5k views
4 votes
What happens when an object's 'finalize()' method is invoked?

a) The object is created
b) The object is sent for garbage collection
c) The object is used in a method call
d) None of the above

User Nayiaw
by
7.7k points

1 Answer

1 vote

Final answer:

The 'finalize()' method is called by the garbage collector to give an object a chance to clean up any resources it has been using before being destroyed.

Step-by-step explanation:

When an object's 'finalize()' method is invoked, it means that the object is being finalized before it is garbage collected.

The 'finalize()' method is called by the garbage collector to give the object a chance to clean up any resources it has been using before being destroyed.

Therefore, the correct answer is b) The object is sent for garbage collection.

User Ilexcel
by
7.5k points