How to validate input beetween 2 String described as Y and N using scanner ?
System.out.println("Are you sure?");
String StrInput = scan.nextLine();
if(strInput = Y && StrInput = N){
System.out.println("Nice choice");
}else{
System.out.println("Please Input only with Y or N");
}
equals()method of String class to check equality of two string likestrInput.equals("Y")