I know and fully agree that sharing constants through interfaces is considered as a bad practice, but I didn't choose this implementation. Whatever:
interface SuperClassConstants {
public static final String CONSTANT = "super";
}
interface SubClassConstants extends SuperClassConstants {
public static final String CONSTANT = "sub";
}
class SuperClass implements SuperClassConstants {
}
class SubClass extends SuperClass implements SubClassConstants {
public SubClass() {
System.out.println(CONSTANT);
// The field CONSTANT is ambiguous
}
}
Why ambiguous? Isn't the constant hidden? I thought Java would have understood I was expecting "sub"
...