Same method in Interface and Abstract class

前端 未结 4 1468
一个人的身影
一个人的身影 2020-11-30 03:02

I came to situation :

public interface Intr {
    public void m1();
}

public abstract class Abs {
    public void m1() {
        System.out.println(\"Abs.m1         


        
4条回答
  •  半阙折子戏
    2020-11-30 03:08

    @Override ensures you override the method with no difference Interface or abstract superclass. So no error with override.

    On the other hand Interface method is also implemented in the superclass which is enough for Interface contracts.

提交回复
热议问题