Guess the letter
The first time the program waits until I enter the symbol, and the second time with the variable res - no. Instead of waiting for keyboard input, the program immediately enters the loop. What is the problem?
public class Alphavite { public static void main(String[] args) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); System.out.println("Загадайте букву"); char ch = (char) reader.read(); System.out.println("Угадайте букву"); char res = (char) reader.read(); while ((ch >= 'A' && ch <= 'Z') || (ch >= 'a') && (ch <= 'z')) { if (res == ch) { System.out.println("Вы угадали! Загаданная буква - " + ch); break; } else { System.out.println("Не угадали. Попробуйте снова"); break; } } } }