阅前声明: http://blog.csdn.net/heimaoxiaozi/archive/2007/01/19/1487884.aspx
/****************** Exercise 11 ***************** * Create a class with a finalize() method that * prints a message. In main(), create an object * of your class. Explain the behavior of your * program. ***********************************************/public class E11_FinalizeCall { protected void finalize() { System.out.println("Finalize called"); } public static void main(String args[]) { new E11_FinalizeCall(); }}
//+M java E11_FinalizeCall
**You probably won’t see the finalizer called. This is typically because the program hasn’t generated enough garbage for the collector to be run.