我来到了情况:
public interface Intr { public void m1(); } public abstract class Abs { public void m1() { System.out.println("Abs.m1()"); } // public abstract void m1(); } public class A extends Abs implements Intr { @Override public void m1() { // which method am I overriding,well it is Abs.m1() but why? // if method implemented is Abs.m1(),then why I am not getting error for Intr.m1() not implemented. } }
解决方法
您一次满足两个条件;即.一个实现同时满足抽象类的要求和接口要求.
作为注释,除非您在另一个继承链中使用Intr,否则不需要它.此外,将实现Intr移动到抽象类定义可能是有意义的.