posted 20 years ago
Question1 :
After method m1 returns, the object created on which line is eligible for garbage collection?
a. 1
b. 2
c. 3
d. 4
e. Compile-time error
f. Run-time error
g. None of the above
Answer: g (none of the above)..
Question 2:
Which of the following is a true statement?
a. The object created a line 1 is eligible for garbage collection after line 2.
b. A NullPointerException is generated at line 3.
c. The program compiles, runs and prints X.
d. The program fails to compile.
e. None of the above
Answer: c.
Can anyone explain why a1 is not elligible for garbage collection in Question1?
And why "i" is not elligible in Question 2?
Thanks in advance..
rajani.
(code tags added - please learn how to do this)
[ May 19, 2004: Message edited by: Barry Gaunt ]