Hi guys,
I'm unable to determine why only (D) is the correct answer to below question.
At a first look I chose (C) & (D) but only (D) is correct.
According to Sun's reply (C) is not correct because even though an object has a valid reference, it still can be garbage collected if no active
thread is able to reach it.
My concern is : A valid reference can be considered as valid only if an active thread can reach it. But according to above explanation, it seems my concept has opposite meaning.
Can anyone please explain ?
Which is true?
A) Invoking System.gc() causes the JVM to perform a garbage collection process.
B) Invoking System.freeMemory() causes the JVM to perform a garbage collection process.
C) An object that has a valid reference cannot be garbage collected.
D) Objects created within inner classes can become eligible for garbage collection.