[英]the method can only set one of public / protected / private
我正在實現一個接口:
public interface Consultant {
// some documentation here explaining it should throw 3 types of exceptions
CellLocation suggest(GameBoard gameBoard);
}
它使用另一個接口:
public interface GameBoard {
CellState getCellState(CellLocation cellLocation);
}
我寫了很多方法,但剛開始實現了所有重要的建議方法。 到目前為止看起來像這樣:
public class YourConsultant implements Consultant {
@Override
public CellLocation suggest(GameBoard gameBoard) {
char[][] arrayBoardGlobal;
Player currentPlayerGlobal;
GameState gameStateGlobal;
return null;
}
}
但是我得到了錯誤
方法建議在類型YourConsultant中只能設置public / protected / private之一
當然,由於界面的原因,我無法將其從公共更改為其他任何內容。
可能是什么原因? 我沒有在這里或網上找到答案,可能是因為它提供了有關訪問修飾符的基本信息。 我正在使用Eclipse Neon。
好吧,我發現了錯誤......在YourConsultant:D之前,我在懸空中留下了一個孤獨的“私人”標簽。 您的評論很有幫助,尤其是要求提供最小,完整和可驗證示例的評論
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.