During my preparation for the
SCJP exam I have come across a type of question for which I don't agree with the given answers.
The question shows a code extract (not an entire program) where several strings are created/accessed in the
string pool. Then, it asks how many objects are eligible for garbage collection after line xy.
But I thought that strings from the string pool are only eligible when the JVM exists
Here's an example from MindQ's exam:
String name;
String newName = "Nick";
newName = "Jason";
name = "Frieda";
String newestName = name;
name = null;
//Line A
Answer is 1 object eligible for garbage collection ???
Thank you to anybody who might push me in the correct direction