用相同的方法在类中实现两个接口。哪个接口方法被重写?两个具有相同方法名称和签名的接口。但是由单个类实现,那么编译器将如何识别哪个方法用于哪个接口?例:interface A{
int f();}interface B{
int f();}class Test implements A, B{
public static void main(String... args) throws Exception{
}
@Override
public int f() { // from which interface A or B
return 0;
}}
3 回答

手掌心
TA贡献1942条经验 获得超3个赞
添加回答
举报
0/150
提交
取消