Why some interface methods are overriden by another interface?
Is it just for documentation purposes (e.g. Deque interface override all methods of the Queue interface, giving them another开发者_JAVA技巧 description), or there are other reasons ?
You can use it to enforce more specific method signatures and return types. Consider:
public interface Foo {
Object result();
}
public interface Bar extends Foo {
@Override
String result(); // Bar redefines result() to return a String
}
精彩评论