public class Garbage {
public static void main(String[] args) {
Example exampleOne = new Example(); //step 1
Example [] exampleArray = new Example[1];//step2
exampleArray[0] = exampleOne;//step3
exampleOne = null;//step4
exampleArray[0]= null;//step5
}
}
class Example{
public Example(){
}
}
是不是step5?为什么??
另外,一个对象数组里面的全部对象为null了,那数组会被回收吗??