Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 466
GregT Avatar asked Sep 13 '16 11:09

GregT


1 Answers

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

like image 73
GregT Avatar answered Sep 21 '22 14:09

GregT