列出并在java中添加随机生成的数字

时间:2016-03-12 01:12:03

标签: java

我需要我的代码列出随机生成的数字以及将它们一起添加但我无法输出任何内容。欢迎任何建议。谢谢!

    Random randomOutput = new Random();
    Scanner input = new Scanner(System.in);

    switch (game) {

        case 3:

            for(int gameLoops = 0; gameLoops > game; ++gameLoops){
                //System.out.println("gameloops is: " + gameLoops);
                int increaseBy = randomOutput.nextInt(9) + 1;
                System.out.println("The numbers randomly generated were: " + randomInt );
                sum += randomInt;
            }   
            break;

        case 4:
            for(int gameLoops = 0; gameLoops > game; ++gameLoops){
                int increaseBy = randomOutput.nextInt(9) + 1;
                System.out.println("The numbers randomly generated were: " + randomInt );
                sum += randomInt;
            }   
            break;

        case 5:
            for(int gameLoops = 0; gameLoops > game; ++gameLoops){
            int increaseBy = randomOutput.nextInt(9) + 1;
            System.out.println("The numbers randomly generated were: " + randomInt );
            sum += randomInt;
            }   
            break; 

    } // End Switch

0 个答案:

没有答案