home *** CD-ROM | disk | FTP | other *** search
/ Java Certification Exam Guide / McGrawwHill-JavaCertificationExamGuide.iso / pc / Web Links and Code / rev / chap4 / q4.java < prev   
Encoding:
Java Source  |  1997-05-08  |  345 b   |  17 lines

  1. class Clean {
  2.    public static void main(String[] args) {
  3.       Dirty d = new Dirty();
  4.       d.finalize();
  5.       d = null;
  6.       Runtime r = Runtime.getRuntime();
  7.       r.gc();
  8.       r.runFinalization();
  9.    }
  10. }
  11.  
  12. class Dirty {
  13.    protected void finalize() throws Throwable {
  14.       System.out.println("Dirty finalization");
  15.    }
  16. }
  17.