Originally posted by Ann Sebastian:
Here are exam qns from MindQ
1. How many objects are eligible for garbage collection once execution has reached the line labeled Line A?
String newName = "Nick";
newName = "Jason";
name = "Frieda";
String newestName = name;
name = null;
2. Which of the following statements about Java's garbage collection are true?
a) The garbage collector can be invoked explicitly using a Runtime object.
b) The finalize method is always called before an object is garbage collected.
c) Any class that includes a finalize method should invoke its superclass' finalize method.
d) Garbage collection behavior is very predictable.
I think the answers are
1.a (0) String literal pool will be referring to all objects
2.b finalise method has to be called atleast once ..
Both were given as wrong...
Could somebody explain this