Hi,
I've a doubt regarding a question from a sample
test.
1)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
I thought the answer is c)2 the String "Frieda" will GC'ed as the ref has been set to null as well as the String "Nick" which is lying in the pool without a reference.
But the answer is given as b. Could some one please explian whether I'm missing something here.
Another question:
The Container methods add( Component comp ) and add( String name, Component comp ) will throw an IllegalArgumentException if comp is a:
a) button
b) list
c) window
d) textarea
e) container that contains this container
Thanks in advance,
Vinod