[英]the method can only set one of public / protected / private
I'm implementing an interface: 我正在实现一个接口:
public interface Consultant {
// some documentation here explaining it should throw 3 types of exceptions
CellLocation suggest(GameBoard gameBoard);
}
It uses another interface: 它使用另一个接口:
public interface GameBoard {
CellState getCellState(CellLocation cellLocation);
}
I wrote a lot of methods, but just started implementing the all-important suggest method. 我写了很多方法,但刚开始实现了所有重要的建议方法。 It looks like this so far:
到目前为止看起来像这样:
public class YourConsultant implements Consultant {
@Override
public CellLocation suggest(GameBoard gameBoard) {
char[][] arrayBoardGlobal;
Player currentPlayerGlobal;
GameState gameStateGlobal;
return null;
}
}
But I get the error 但是我得到了错误
The method suggest in type YourConsultant can only set one of public / protected / private
方法建议在类型YourConsultant中只能设置public / protected / private之一
Of course I cannot change it from public to anything else because of the interface. 当然,由于界面的原因,我无法将其从公共更改为其他任何内容。
What could be the cause? 可能是什么原因? I haven't found the answer here or the net, probably because it brings up basic info about access modifiers.
我没有在这里或网上找到答案,可能是因为它提供了有关访问修饰符的基本信息。 I'm using Eclipse Neon.
我正在使用Eclipse Neon。
Okay, I found the error... I left a lonely "private" tag hanging in the air a few lines before YourConsultant :D. 好吧,我发现了错误......在YourConsultant:D之前,我在悬空中留下了一个孤独的“私人”标签。 Your comments were helpful, especially the one asking for a Minimal, Complete and Verifiable example
您的评论很有帮助,尤其是要求提供最小,完整和可验证示例的评论
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.