package chapter5;

class Person implements AutoCloseable {
    String name;
    public Person(String name) {
        this.name = name;
    }

    public void close() {
        System.out.println( name + " 要被回收啦！");
    }
}

public class Example13 {
    public static void main(String[] args) {
        Person p1 = new Person("小明");
        Person p2 = new Person("大王");

        p1 = null;
        p2 = null;

        System.gc();

        for (int i = 0; i < 1000000; i ++) {
            // 为了延长程序运行的时间
        }
    }
}
