protected void finalize() throws Throwable : finalize « Class Definition « Java Tutorial






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








5.33.finalize
5.33.1.protected void finalize() throws Throwable