Consider the following interface in Java:
public interface I {
public final String KEY = \"a\";
}
And the following class:
As a design consideration,
public interface I {
public final String KEY = "a";
}
The static methods always returns the parent key.
public class A implements I {
public String KEY = "b";
public String getKey() {
return KEY; // returns "b"
}
public static String getParentKey(){
return KEY; // returns "a"
}
}
Just like Jom has noticed. The design of static methods using re-defined interface members could be a heavy problem. In general, try to avoid use the same name for the constant.