E
escas
Gast
hallo ich möchte das der garbage collector die finalize aufruft was er nicht macht. bloss wieso?
Code:
public class finalizeationThread extends Thread{
public finalizeationThread(int num)
{
super("#finalizeationThread#" + num);
start();
System.out.println(getName() + " start");
}
public void run()
{
System.out.println(getName() + " run");
try {
sleep(100);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
System.gc();
System.runFinalization();
}
protected void finalize()
{
System.out.println(getName() + " end");
}
}