Developer's Daily Java Education - Test Projects
  front page | java | perl | unix | DevDirectory
   
Front Page
Java
Education
   
 


public class ExampleStaticClass
{

  // static initializer block
  static
  {
    System.err.println( "    just did static initialization of ExampleStaticClass" );
  }

  public ExampleStaticClass()
  {
    System.err.println( "    just entered constructor of ExampleStaticClass, free memory: " + Runtime.getRuntime().freeMemory() );
  }

  public static final String getAString()
  {
    System.err.println( "    leaving ExampleStaticClass.getAString, free memory: " + Runtime.getRuntime().freeMemory() );
    return "a string";
  }

  public static final double getADouble()
  {
    return 10.00;
  }

  public void finalize()
  {
    System.err.println( "    just ran finalize in ExampleStaticClass" );
    System.err.println( "    ExampleStaticClass.finalize, free memory: " + Runtime.getRuntime().freeMemory() );
  }

}
Copyright © 1998-2003 DevDaily Interactive, Inc.
All Rights Reserved.