我正在尝试用Java创建一个简单的文本冒险游戏,当我键入Quit时,它结束了游戏.但相反它会询问你是否想要执行任务,即使你输入quit,假设结束代码,我尝试使用循环来修复此错误,但不得不运气.知道我哪里错了吗?
import java.util.*;
public class TextGame {
public static void main(String[] args) {
//Boolean run = true;
//while (run){
Scanner in = new Scanner(System. in );
System.out.println("~SPECTRE~");
System.out.println("");
System.out.println("Please Choose One Below");
System.out.println("");
System.out.println("New");
System.out.println("Quit");
System.out.println("");
String option;
System.out.print("Select one of the options here: ");
option = in .next();
if (option.equals("New")) {
System.out.println("Hello adventurer! Welcome to the land of Spectre.");
String name;
System.out.print("What is your name adventurer? ");
name = in .next();
System.out.println("Hello there! " + name);
} else if …Run Code Online (Sandbox Code Playgroud)