I have three classes with same methods and only constants are different. So what I wanted is to create one base class, which contains all the methods and to add three child classes which contain only constant variables. It looks like it is not possible to do so because of the dynamic binding. Please look at the example:
public class Parent {
static String MY_CONSTANT = "bla bla";
public void printSomething() {
System.out.println(MY_CONSTANT);
}
}
public class Child extends Parent …Run Code Online (Sandbox Code Playgroud)