posted 17 years ago
void m1() {
Q q1 = null;
for (int i = 0; i < 10; i++) {
q1 = new Q(); // 1
m2(q1); // 2
}
System.out.print("All done"); // 3
}
When the processing of line 3 begins, how many objects of type Q that were created at line 1 have become eligible for garbage collection?
a. 0
b. 1
c. 9
d. 10
e. Indeterminate.
f. Compile-time error
g. Run-time error
h. None of the above
Ans:E
Doubt: Is it always true that in case if the object�s are passed to a method whose implementation is not shown, we cannot be sure of object's being Garbage Collected, so the answer Intermediate
please help,
gitesh