插入while(表达式):完成Do语句需要帮助

时间:2018-02-21 20:40:51

标签: java arrays

我有两个问题,一个是语法错误。我试图定义钱并将其定义为int但它仍然获得描述资源路径位置类型 令牌“money”上的语法错误,@在此令牌行之后的预期23 Java问题。我还得到[]来完成维度并插入标识符来完成方法头名。 import java.util。*;

public class Blackjack{

    public static void main(String[] args) {
        ;}
        private static int money;// the money the player bets with
        private static int bet;//how much the user wants to bet
        private static int AceCounter;//how many aces are in the user's hand
        private static ArrayList<Card> hand;//represents the user's hand
        private static int handvalue;//the value of the user's hand
        private static String name; //name of the user
        private static int cash; // how much money in the bet
            {

         while (money>0) {
             money = 1000; 
         }}

       money money("You have " + money + " dollars.")); 
    do {

第二个是数组由于某种原因我不断收到错误声明我需要插入一个while表达式来完成do语句

while(!isyesorno(answer))
                {
                    System.out.println("Please answer yes or no.");
                    answer = yesorno.nextLine();
                }
        if(answer.equals("no"))
        {
            break;
        }
    }
        System.out.println("Your cash is: "+cash);//If no new game then game ends and tells them how much they have won or lost.

        if(cash==0)
        {
            System.out.println("You ran out of cash!");
        }
        else
        {
            System.out.println("Enjoy your winnings, "+name+"!");
        }
     }
}}  

1 个答案:

答案 0 :(得分:0)

我对你的问题很关注:

  1. 您的static void main方法会立即关闭,这就是您收到此错误的原因。
  2. 我在代码中看到很多错误。仅举几说, enter image description here
  3. 这清楚地表明您没有尝试过自己调试它。它是Java编程的基础。我建议你到Oracle Java Doc页面(while-loop)并输入那里写的内容。