【发布时间】:2013-06-17 17:04:27
【问题描述】:
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
}
当我尝试编译 DerivedClass 时,它给了我错误
我应该如何解决这个问题?
【问题讨论】:
-
现在听起来很有趣
-
那么
public String myMethod() {...}真的有问题吗?据我了解,唯一的问题是紧随其后的线路。我错过了什么吗?
标签: java inheritance interface