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
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.
Okay, I found the error... I left a lonely "private" tag hanging in the air a few lines before YourConsultant :D. Your comments were helpful, especially the one asking for a Minimal, Complete and Verifiable example
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.