执行“m1=null;m2=空;“?
2022-08-31 15:10:38
执行后,我感到困惑。有多少对象符合垃圾回收的条件?m1 = null;
m2 = null;
public class MyTest {
MyTest m;
void show() {
System.out.println("Hello this is show method.");
}
public static void main(String args[]) {
MyTest m1 = new MyTest();
MyTest m2 = new MyTest();
MyTest m3 = new MyTest();
m1.m = m2;
m2.m = m3;
m3.m = m1;
m1 = null;
m2 = null;
// Question here: How many objects will be eligible for garbage collection?
}
}