我试图让用户输入一个字符(“y”/“n”)并检查这是否是正确的答案。我收到以下错误:“无法比较的类型:java.util.Scanner 和 java.lang.String”
Scanner userInput = new Scanner(System.in);
System.out.printf("Is this word spelled correctly?: %s", wordToCheck);
rightCheck(userInput);
public boolean rightCheck(Scanner usersAnswer)
{
if(usersAnswer == "y")
{
//"Correct!"
//Increment User's Score
}
else
{
//"Incorrect"
//Decrement User's Score
}
}