// this code demonstrates the usage of class constructors and finalizers

public class ConstrFinal
{
   public static void main(String[] args)
   {
      ConstrFinalTest t1 = new ConstrFinalTest();
      ConstrFinalTest t2 = new ConstrFinalTest();


      t1 = null;         // setting the class pointers to null   
      t2 = null; 

      System.gc();       // explicit call of the garbage collector
   }
}

class ConstrFinalTest
{
   public ConstrFinalTest()       // class constructor will be called any
   {                              // time when the class is instantiated
      System.out.println("Greetings from the constructor");
   }

   protected void finalize()      // class finalizer will be called by
   {                              // the garbage collector
      System.out.println("Greetings from the finalizer");
   }
}
