出于某种原因,我从输入小写“y”得到的结果与输入大写“Y”不同。“y”的输入执行 if 语句中的代码,但“Y”的输入不执行。此外,输入“Y”不会执行中断;之后。为什么会这样,我做错了什么?
Scanner playAgain = new Scanner (System.in);
System.out.println ("Play Again (Y/N)");
if ((playAgain.next().equals("y"))||(playAgain.next().equals("Y")))
{
Game theGame1 = new Game(0);
currentPts = currentPts + theGame1.play(total);
System.out.println("Current total is:" + " " + currentPts);
}
else break;