Original Post
class A
{
public static void print()
{
System.out.println(A.class); // here
}
}
class B extends A
{
}
public class Main
{
public static void main(String[] args)
{
B.print();
}
} This prints "class A". Is there anything else I can write in the commented line that will make subclasses of A print their own class instead of A? I tried getClass(), but that doesn't work in a static context. My ultimate goal is a static method that reflects on subclasses.