나는 SCJP 준비 사이트에서이 질문을하고 있었다. 답변 A는 정확합니까?자바 가비지 콜렉션
"// some code goes 여기"란 줄에있는 a, b, aa가 참조하는 객체에 대해서는 무엇이 사실입니까?
class A {
private B b;
public A() {
this.b = new B(this);
}
}
class B {
private A a;
public B(A a) {
this.a = a;
}
}
public class Test {
public static void main(String args[]) {
A aa = new A();
aa = null;
// some code goes here
}
}
A) The objects referenced by a and b are eligible for garbage collection.
B) None of these objects are eligible for garbage collection.
C) Only the object referenced by "a" is eligible for garbage collection.
D) Only the object referenced by "b" is eligible for garbage collection.
E) Only the object referenced by "aa" is eligible for garbage collection.
답변 :