对于我的第一个 Java 项目,我正在尝试制作一个简单的基于文本的游戏。似乎 or 管道不起作用,当我尝试在它不起作用后输入一些东西时;我必须重新启动它。
public void GameStart() {
String playerName = "Player";
String Command = "Choice";
System.out.println("Type Start to start game!");
if(in.nextLine().equals("Start") || in.nextLine().equals("start")) {
Help();
print("Type Begin to start game :D");
if(in.nextLine().equals("Begin") || in.nextLine().equals("begin")) {
System.out.println("Who are you?");
开始和开始工作,但像我使用的第一个字母小写 || 因为没有。当我使用它们时,我必须重新启动它,因为我无法输入任何内容,但我显然有或管道说要使用其中任何一个。有谁知道是什么原因造成的?