Java 1.5
I'm not sure if this is possible, but I'd like to get the class name of the class that instantiated my class. For example:
Would output the name of Foo's class. Is that possible?
Thanks!
I'm not sure if this is possible, but I'd like to get the class name of the class that instantiated my class. For example:
Code:
public class Foo { public static void main(String args[]) { Bar b = new Bar(); } } ... public class Bar { public Bar() { System.out.println(parent.class.getName()); } }
Thanks!
Comment