标签:exception nali ring log str div bool span final
public class Test { public static void main(String[] args) throws Exception { Book b=new Book(true); b.checkIn(); new Book(true); System.gc(); } } class Book{ boolean checkdOut = false; Book (boolean checkOut) { checkdOut = checkOut; } protected void checkIn() { checkdOut = false; } protected void finalize() { if (checkdOut) { System.out.println("Error : check Out"); } } }
在执行回收机制之前会先执行finalize();
标签:exception nali ring log str div bool span final
原文地址:http://www.cnblogs.com/chenglc/p/7424390.html