[3148] in java-interest

home help back first fref pref prev next nref lref last post

Re: Q on static method reference to class

daemon@ATHENA.MIT.EDU (Arthur van Hoff)
Wed Nov 1 18:47:51 1995

Date: Wed, 1 Nov 1995 11:45:43 -0800
From: Arthur.Vanhoff@Eng.Sun.COM (Arthur van Hoff)
To: rbk@ibeam.jf.intel.com
Cc: java-interest@java.Eng.Sun.COM


Hi Bob,

> Suppose I want to refer to the class in a static method, eg to get the name
> of the class, or create a new instance... How do I do this?  If I'm in an
> instance method, I can say (eg) "getClass().getName()".  However, trying
> various things in a static method gets compiler errors.  Surely there must
> be a way to do this cleanly without referring to the class by name?

Try this: 

	Class foo = Class.forName("Foo");
	
Have fun,

	Arthur van Hoff
-
This message was sent to the java-interest mailing list
Info: send 'help' to java-interest-request@java.sun.com

home help back first fref pref prev next nref lref last post