I want to have the following setup:
abstract class Parent {
public static String ACONSTANT; // I'd use abstract here if it was allowed
// Other stuff follows
}
class Child extends Parent {
public static String ACONSTANT = "some value";
// etc
}
Is this possible in java? How? I'd rather not use instance variables/methods if I can avoid it.
Thanks!
EDIT:
The constant is the name of a database table. Each child object is a mini ORM.
you can't do it exactly as you want. Perhaps an acceptable compromise would be:
abstract class Parent {
public abstract String getACONSTANT();
}
class Child extends Parent {
public static final String ACONSTANT = "some value";
public String getACONSTANT() { return ACONSTANT; }
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With