析构函数和GC
public class GcTest{public void finalize(){System.out.println("GcTest is going ...");}public static void main(String[] args){new GcTest();new GcTest();new GcTest();System.gc(); //没有gc调用,析构函数finalize()不会被调用System.out.println("GcTest is ending ...");}}
?