Java OCA OCP Practice Question 173

Question

Which of the following are true about an object's finalize() method?

  • A. It can be invoked multiple times by the garbage collector.
  • B. If it is invoked, the object will be garbage collected.
  • C. If the object has been garbage collected, its finalize() method has been invoked.
  • D. It must perform cleanup operations.


C.

Note

An object's finalize() method may only be invoked once by the garbage collector.

If an object's finalize() method is invoked, there is no guarantee that it will be garbage collected.

If the object has been garbage collected, then its finalize() method must have been invoked.

The finalize() method performs cleanup operations prior to garbage collection.

The finalize() method is not required to do so.




PreviousNext

Related