为什么我的while语句不起作用?

时间:2017-07-12 19:56:55

标签: java while-loop

所以,我正在编写一个非常简单的基于文本的游戏,当我注意到我的while语句豁免了游戏的关键部分时。括号都是正确的。也许你们其中一个可以帮助我?

以下是代码:

if (isActionPile .equals("Attack Over")){
        System.out.println("\n\nWelcome to the Travel Menu. Here you can decide where to travel, what items\n" +
                "and upgrades you wish to buy, and of course, see you inventory!");
        while (isWhileStatementAssist != "Done") {
            System.out.println(isTravelMenu);
            isActionPile = Scan.nextLine();
            if (isActionPile.equals("Item Shop")) {
            //This part doesn't matter
                }
//This is the trouble spot!
            if ((isActionPile.equals("Character Menu"))) {
                System.out.println("Your attack is " + isArthurAttack + ", your Health Points are at " +
                        isArthurHealth + " and you have $" + isArthurMoney + "\nTo leave this menu press enter.");
                isActionPile = Scan.nextLine();
                isActionPile = null;
                isWhileStatementAssist = null;
            }
            if (isActionPile.equals("Movement Menu")) {
            //I haven't started this part yet!
            }
            }
        }

所以,我甚至更加努力地添加了一个名为“isWhileStatementAssist = null;”的部分。你们中的任何人都能看到问题吗?

谢谢, 戴夫

0 个答案:

没有答案