下面的代码只是不断给出 else 错误消息,我不知道出了什么问题..
Boolean loop2 = true;
userInput = scan.next();
while (loop2) {
userInput = scan.next();
if(userInput.toLowerCase() == "") {
out.println(
"Please pick a option! it's in the 'Commands' <= type this in!"
);
loop2 = true;
} else if(userInput.toLowerCase() == "fight") {
Fights(); loop2 = false;
} else if(userInput.toLowerCase() == "train") {
Training(); loop2 = false;
} else if(userInput.toLowerCase() == "bosses") {
Bossing(); loop2 = false;
} else if(userInput.toLowerCase() == "shops") {
ShopsAll(); loop2 = false;
} else if(userInput.toLowerCase() == "commands") {
Menu(); loop2 = false;
} else {
out.println("ERROR MESSAGE!!.");
}
}