> From: Dave [mailto:[EMAIL PROTECTED] > Subject: OT: a java question - static initialization > > class Foo { > private static int; > static { > a = 100; > } > Foo() { > } > } > > Class.forName("package.Foo").newInstance(); > > The static init block of Foo is not called.
Works fine for me under 1.5.0_14 (and other levels). Since your example code is chock full of syntactic and semantic errors, you might want to correct those first and publish actual code. Here's what ran for me: package myPackage; class Foo { private static int a; static { a = 100; } Foo() { } public String toString() { return Integer.toString(a); } } package myPackage; public class FooMain { static public void main(String[] args) throws Exception { System.out.println(Class.forName("myPackage.Foo").newInstance()); } } - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. --------------------------------------------------------------------- To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]