Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/309.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/variables/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 应用continue语句,该语句将跳过打印程序所涉及变量的前10个数值_Java_Variables_Numbers - Fatal编程技术网

Java 应用continue语句,该语句将跳过打印程序所涉及变量的前10个数值

Java 应用continue语句,该语句将跳过打印程序所涉及变量的前10个数值,java,variables,numbers,Java,Variables,Numbers,我需要应用一个continue语句,它将跳过打印前10个值 我已经有密码了 public class numbers { public static void main(String[] args) { for (int number=1; number <= 99; number++){ if (number % 2 == 0) System.out.print(number + " " );

我需要应用一个continue语句,它将跳过打印前10个值

我已经有密码了

public class numbers {

    public static void main(String[] args) {

         for (int number=1; number <= 99; number++){

             if (number % 2 == 0)
                 System.out.print(number + " " );

                        System.out.println();
             }
         }
    }
公共类编号{
公共静态void main(字符串[]args){
对于(int number=1;number添加计数器:

public static void main(String[] args) {
     int counter = 0;
     for (int number = 1; number <= 50; number++) {
         if (number % 2 == 0) {
             counter++;
             if (counter <= 10) {
                 continue;
             }
             System.out.println(number + " " );
         }
     }
}

再要一个柜台

    int count = 0;
    for (int number=1; number <= 50; number++){

        if (number % 2 == 0 && count++ >= 10)
        {
            System.out.print(number + " " );
            System.out.println();
        }
   }
int count=0;
对于(整数=1;整数=10)
{
系统输出打印(数字+“”);
System.out.println();
}
}
或者如果您想使用continue

    int count = 0;
    for (int number=1; number <= 50; number++){

        if (number % 2 == 0)
        {
            if (count++ < 10)
                   continue;

            System.out.print(number + " " );
            System.out.println();
        }
   }
int count=0;

对于(int number=1;number),然后对“if”和“continue”进行一些研究,而不是扔掉一些可能只是你作为家庭作业的起始模板的东西。提示:你通过积极尝试来学习编程。他是一个要求使用continue的新手,因为他的作业告诉他这样做。你的答案并不能解决所有问题。并且向一个无法写下“continue”的人抛出一条流…说真的吗?我读到的是我需要使用continue语句。
    int count = 0;
    for (int number=1; number <= 50; number++){

        if (number % 2 == 0)
        {
            if (count++ < 10)
                   continue;

            System.out.print(number + " " );
            System.out.println();
        }
   }