I'm starting to create game and now I'm testing for player input.
package main;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
public class Game {
    public static void main(String[] args) throws IOException {
        final char[] keyCodesArray = {'w','a','s','d'};
        while(true) {
            char tmp = (char) new InputStreamReader(System.in).read ();
            if(Arrays.asList(keyCodesArray).contains(tmp)) {
                System.out.println("You entered : " + tmp);
            } else {
                System.out.println("Type valid game char");
            }
        }
    }
}
Why, when I press 'w' or 'a', console prints second communicate: "Type valid game char" and not the first one? I searched StackOverflow for an answer but nothing really helped me.
 
     
     
    