Spot false dilemmas now, ask me how!
(If you're not on the edge, you're taking up too much room.)
"I'm not back." - Bill Harding, Twister
Spot false dilemmas now, ask me how!
(If you're not on the edge, you're taking up too much room.)
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 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
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
SCJP- 98%<br />SCWCD-92%
So there I was, trapped in the jungle. And at the last minute, I was saved by this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
|