statically calling getClass().getName()
Posted on 2002-07-18
I'm just curious ... I don't need to do this for any reason, but ...
Is it possible to call the getName() method statically for a given class?
public class MyClass
public static void main( String args )
System.out.println( getClass().getName() );
ofcourse, the above example produces a compiler error because there is no instatiated "this" object from which to call the method (the method itself is not static). Is it possible to get the current classname in this manner (from main() -- other than println("MyClass") ?