Hello, I am working on a terminal based game and have a problem with the scanner.
The below code is part of the "players turn". The first time the method is called for the game, it prints once and works perfectly. Then during the second calling & onwards, it prints the "Message..." and "type a command:..." lines twice before it offers me to input a string into the terminal.
I have been trying to fix this for hours... Im working in netbeans but have also taken it to bluej and used that debugged to trace, it simply skips over it the first time (after the second time its called).Code:
System.out.println("type a command: play, move, exit");
String keyWord = scan.nextLine();
int number scan.nextInt();