当我尝试编译它,我有错误,我有以下的代码片段继承方法与无关的返回类型
public class Test {
static interface I1 { I1 m(); }
static interface I2 { I2 m(); }
static interface I12 extends I1,I2 { I12 m(); }
public static void main(String [] args) throws Exception {
}
}
。
Test.java:12: types Test.I2 and Test.I1 are incompatible; both define m(), but with unrelated return types.
如何避免这种情况?
[在一个类中使用相同的方法实现2个接口的可能的重复。哪种接口方法被重写?](http://stackoverflow.com/questions/2801878/implemeting-2-interfaces-in-a-class-with -same-method-which-interface-method-is-o) – Matthias 2012-03-14 14:49:11
或更好的重复:http://stackoverflow.com/questions/2598009/method-name-collision-in-interface-implementation-java – Matthias 2012-03-14 14:51:00
我读过这些问题,但我没有看到我的问题的答案,我可以如何避免这种情况? – 2012-03-14 14:52:48