Cha*_*har 1 java interface multiple-inheritance
interface i1{
int test();
}
interface i2{
String test();
}
class Test implements i1,i2{
<Return type> test(){
//code here
}
}
Run Code Online (Sandbox Code Playgroud)
如果实现方法的返回类型为int,则错误表示返回类型与i2.test()不兼容 如果实现方法的返回类型为String,则错误表示返回类型与i1.test()不兼容
我应该如何在我的类Test中实现这两个接口
任何帮助都很明显.
归档时间: |
|
查看次数: |
226 次 |
最近记录: |