Your askLetter method closes the scanner ... which closes System.in . Then you try to reuse System.in inside decide .
Modify the constructor to accept the Scanner that you create in main . Then save this scanner in the field and use it in both methods:
public static void main(String[] args) { Scanner scanner = new Scanner(System.in); TicTacToe tictac = new TicTacToe(scanner); tictac.askLetter(); tictac.decide();
It also helps make your code more reliable - now you can use Scanner , which is supported by fake data (for example, a StringReader ).
source share