1 // Copyright 2008 The Android Open Source Project 2 3 import java.lang.ref.WeakReference; 4 5 public class FinalizerTest { 6 public static FinalizerTest mNothing = new FinalizerTest("nothing"); 7 public static FinalizerTest mReborn = mNothing; 8 9 public String mMsg = "default"; 10 11 public FinalizerTest(String msg) { 12 mMsg = msg; 13 } 14 15 public String toString() { 16 return mMsg; 17 } 18 19 protected void finalize() { 20 System.out.println("finalizer executed: " + mMsg); 21 mReborn = this; 22 } 23 } 24