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(); } }