首先我先建了一個類M 查看何時調用 finalize方法ide
public class M {
@Override
protected void finalize() throws Throwable {code
System.out.println("~finalize");
super.finalize();
}
}orm
public class NormalReference {io
public static void main(String[] args) throws IOException { M m = new M();
m=null;
System.gc();
System.out.println(m);
System.in.read();
}
}class