In reference to Java, I would like to statically know the class name of the current class. A is the parent class of B. I would like to have a static String in A (parent class) which contains the class name of the current class, but when this static String is referenced in B (child class), it should contain the class name of B. Is this possible?
Example:
public class Parent {
protected static String MY_CLASS_NAME = ???
.
.
.
}
public class Child extends Parent {
public void testMethod() {
if (MY_CLASS_NAME.equals(getClass().getName())) {
System.out.println("We're equal!");
}
}
}