我理解多重继承的概念,尽管我试图访问两个接口(interface)中给出的相同方法。示例:-
interface Interface1{
int show();
void display();
}
<小时/>
interface Interface2 {
int show();
void display();
}
<小时/>
class Impl implements Interface1, Interface2 {
// how to override show() and display() methods such that
// i could access both the interfaces
}
最佳答案
由于接口(interface)没有方法定义。您覆盖哪个接口(interface)的 show 方法并不重要。
关于java - 使用具有相同方法的两个接口(interface)实现多重继承,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9768204/