hi all,
What ever i have read abt
String literals
and garbage collection it tells that String literals are not garbage collected as these are not created by new operator (so they are not objects).
But what if questions like these come in the exam ???
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
On the exam do they have such questions..without new operator created objects?
what should we consider?? should we ignore the fact that string literals are not Gced and choose
some option?
Thanks
swapna