Mình có bài toán như này: nhập O hoặc E từ bàn phím, nếu sai bắt nhập lại.
Nhưng khi mình Run thì nó không chạy phần if mà chỉ chạy ra phần else:
System.out.println("Select Odd or Even number (O/E) : ");
boolean check = true;
do {
char input = sc.next().charAt(0);
if (input=='o'&&input=='e'||input=='O'&&input=='E') {
Random rd = new Random();
int number = rd.nextInt(100);
System.out.println("A new generated random number is : "+number);
check = false;
} else {
System.out.println("Please write O/E: ");
String again = sc.nextLine();
}
} while (check);