Garbage Collections - Programming

Q1:

Which statement is true?

A Calling Runtime.gc() will cause eligible objects to be garbage collected.

B The garbage collector uses a mark and sweep algorithm.

C If an object can be accessed from a live thread, it can't be garbage collected.

D If object 1 refers to object 2, then object 2 can't be garbage collected.

ANS:C - If an object can be accessed from a live thread, it can't be garbage collected.

This is a great way to think about when objects can be garbage collected. Option A and B assume guarantees that the garbage collector never makes. Option D is wrong because of the now famous islands of isolation scenario.