我在SCJP准备网站上经历了这个问题.答案A如何正确?
a,b,aa在标有"// some code goes here"的行引用的对象的真实情况是什么?
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 …Run Code Online (Sandbox Code Playgroud)