I have a class that is abstract with a couple of abstract methods and I need all the classes that inherit from it to have a final field static String em> which contains the 'simple' name of the daughter class, called TAG. I've been trying it in various ways, but they all prevent me from compiling.
Is it possible to do it? And if so, how is it done?
So that it works for me, but I do not want it done as a field of the instance.
abstract class A{
protected final String TAG;
public A() {
TAG = getClass().getSimpleName();
}
}
I want to get the TAG from the daughter class as if it were from the class, not from the instance, like this:
class B extends A {
public void mostrar() {
System.out.println(B.TAG);
}
}