FileDocCategorySizeDatePackage
StaticIniDemo.javaAPI DocExample1068Sat Nov 25 12:55:48 GMT 2000None

StaticIniDemo

public class StaticIniDemo extends Object
Show static initializers. These are run when the class is loaded. If you run the main program here, you will see the static initializer before the "About to load class", since the class is loaded before main gets run. If you copy the guts of main into another class, the messages will come out in the "expected" order.
author
Ian F. Darwin, ian@darwinsys.com
version
$Id: StaticIniDemo.java,v 1.4 2000/11/25 17:55:48 ian Exp $

Fields Summary
Constructors Summary
public StaticIniDemo()
A constructor -- called when object is instantiated.

		System.out.println("In static initializer");
	
		System.out.println("In Constructor");
	
Methods Summary
public static voidmain(java.lang.String[] a)

		try {
			System.err.println("About to load class");
			Class c = Class.forName("StaticIniDemo");
			System.err.println("About to construct instance");
			Object sd = c.newInstance();
			System.err.println("Object is " + sd);
		} catch (Exception e) {
			e.printStackTrace();
		}