Java Tutorial/Class Definition/finalize
Версия от 17:44, 31 мая 2010; (обсуждение)
protected void finalize() throws Throwable
public class Main {
private static int id;
private int myId;
Main() {
myId = id++;
System.out.println("Created #" + myId);
}
protected void finalize() throws Throwable {
System.out.println("Finalized #" + myId);
super.finalize();
}
public static void main(String[] args) {
Main fd;
for (int i = 0; i < 10000; i++)
fd = new Main();
}
}