关于垃圾收集器和nested class的问题
public class TestBed
{
public TestBed()
{
}
public void f()
{
System.out.println( "f()" );
}
public static class Tester
{
public static void main(String[] args)
{
TestBed t = new TestBed();
t.f();
}
}
}
这是think in java中的一个例子,为什么在我的JCreator中可以通过编译但是不能运行呢?
public class Ex_12
{
public void finalize()
{
System.out.println( "Finalize!" );
}
public static void main(String[] args)
{
Ex_12 ex = new Ex_12();
System.gc();
}
}
这个类为什么不能调用finalize()方法?