Class 实现扩展另一个接口的接口

Class implements Interface that extends another Interface

我想在我的 class 中实现一个从另一个接口扩展的接口,但我收到以下错误:

Class1 is not abstract and does not override abstract method method2(param1,param2) in Interface2

public class Class1 implements Interface1 {       
    public Class1() {
        //some init
    }

    @Override
    public Object method1(Object param1) {
        //some code
    }

    @Override
    public void method2(Object param1, Object param2) {
        //some code
    }         
}

public interface Interface1 extends Interface2 {       
     //some specific code
}

public interface Interface2 {
    public Object method1(Object param1);
    public void method2(Object param1, Object param2);
}

为什么它不起作用,我必须做什么才能让它起作用?

提供参数 param1 和 param2 的类型 试试这个

  public class Class1 implements Interface1 {       
    public Class1() {
        //some init
    }

    @Override
    public Object method1(String param1) {
        //some code
        return null;
    }

    @Override
    public void method2(String param1,String param2) {
        //some code
    }         
}


 interface Interface1 extends Interface2 {       
     //some specific code
}


 interface Interface2 {
    public Object method1(String param1);
    public void method2(String param1,String param2);
}