How many objects are eligible for garbage collection once execution has reached the line labeled Line A?
String name;
String newName = "Nick";
newName = "Jason";
name = "Frieda";
String newestName = name;
name = null;
//Line A
a) 0
b) 1
c) 2
d) 3
e) 4
Correct answer is b)1.
I thought correct answer is a)0. Because their is reference to it from String pool always even though their are no references to "Nick" object
in the program.
How???