该方法只能设置public/protected/private之一

Gre*_*egT 10 java eclipse compiler-errors

我正在实现一个接口:

public interface Consultant {
    // some documentation here explaining it should throw 3 types of exceptions
    CellLocation suggest(GameBoard gameBoard);
}
Run Code Online (Sandbox Code Playgroud)

它使用另一个接口:

public interface GameBoard {
    CellState getCellState(CellLocation cellLocation);
}
Run Code Online (Sandbox Code Playgroud)

我写了很多方法,但刚开始实现了所有重要的建议方法.到目前为止看起来像这样:

public class YourConsultant implements Consultant {
    @Override
    public CellLocation suggest(GameBoard gameBoard) {
        char[][] arrayBoardGlobal;
        Player currentPlayerGlobal;
        GameState gameStateGlobal;
        return null;
    }
}
Run Code Online (Sandbox Code Playgroud)

但是我得到了错误

方法建议在类型YourConsultant中只能设置public/protected/private之一

当然,由于界面的原因,我无法将其从公共更改为其他任何内容.

可能是什么原因?我没有在这里或网上找到答案,可能是因为它提供了有关访问修饰符的基本信息.我正在使用Eclipse Neon.

Gre*_*egT 14

好吧,我发现了错误......在YourConsultant:D之前,我在悬空中留下了一个孤独的"私人"标签.您的评论很有帮助,尤其是要求提供最小,完整和可验证示例的评论

  • 该死的,它犯了同样的错误,私下吊死 (2认同)