Garbage Collections - Programming

Q1:

Which statement is true?

A All objects that are eligible for garbage collection will be garbage collected by the garbage collector.

B Objects with at least one reference will never be garbage collected.

C Objects from a class with the finalize() method overridden will never be garbage collected.

D Objects instantiated within anonymous inner classes are placed in the garbage collectible heap.

ANS:D - Objects instantiated within anonymous inner classes are placed in the garbage collectible heap.

All objects are placed in the garbage collectible heap. Option A is incorrect because the garbage collector makes no guarantees. Option B is incorrect because islands of isolated objects can exist. Option C is incorrect because finalize() has no such mystical powers.