Which of the given objects are eligible for Garbage collection after line 14 of the following code snippet?
class Test {
TestThis testthis;
public Test(){
testthis = new TestThis(this);
}
class TestThis {
Test test1;
public TestThis(Test aThis) {
test1 = aThis;
}
}
public static void main (String[] args){
Test test2 = new Test();
test2 = null; // line 14
}
}
Select
test1
testthis and test1
testthis, test1 and test2
None
Answers
Answered by
0
Answer:
Explanation:
void start() {
A a = new A();
B b = new B();
a.s(b);
b = null; /* Line 5 */
a = null; /* Line 6 */
System.out.println("start completed"); /* Line 7 */
Similar questions