public interface MyInterface{
public int myMethod();
}
public class SuperClass {
public String myMethod(){
return "Super Class";
}
}
public class DerivedClass extends SuperClass implements MyInterface {
public String myMethod() {...} // this line doesn't compile
public int myMethod() {...} // this is also unable to compile
}
それはどのように私はこの問題を解決する必要がありインターフェイスと継承:私は<code>DerivedClass</code>をコンパイルしようとすると、「戻り値の型intに互換性がない」
java: myMethod() in interfaceRnD.DerivedClass cannot override myMethod() in interfaceRnD.SuperClass return type int is not compatible with java.lang.String
私にエラーを与えて?
今では – Xinus
だから '公共の文字列に何か問題が実際にそこにある面白そうmyMethod(){...} '?私の理解から、唯一の問題は直後の行です。私は何か見落としてますか ? – Josay