在Java中重载接口方法

She*_*ock -4 java overloading interface

我有以下代码:

public interface Block {
    public double[] getOutput();
    public double[] getOutput(double[] inputs);
}

public class Dataset implements Block{

    public double[] getOutput(){
        return(new double[0]);
    }
}
Run Code Online (Sandbox Code Playgroud)

我正在使用netbeans IDE,它会产生以下消息:

Dataset is not abstract and does not override abstract method getOutput(double[]) in Block
Run Code Online (Sandbox Code Playgroud)

我不确定为什么会发生这种情况..任何帮助将不胜感激

谢谢

Gre*_*ill 6

您的Dataset类必须提供该getOutput(double[])函数的实现.如上所述,它仅提供getOutput()(没有参数)的实现.