总结:continue用法是:在for,do-while.while循环中

并且,continue的意思是跳出循环的剩余部分,进行下一次循环。不是下一步循环

package com.b;

import java.util.Scanner;
//用continue写出。。输出奇数——————
//continue和break的区别//continue常用在for,while.do-while循环中

public class gf {
	public static void main(String[] args) {
		Scanner c = new Scanner(System.in);
		System.out.println("请输入====");
		int x = c.nextInt();
		for (int i = 0; i < x; i++) {
			if (i % 2 == 0)
				continue;// 终止本次循

			System.out.println("" + i);// 当不满足被2整除时,输出当前i的值

		}
	}
}
//
请输入====
12
1
3
5
7
9
11

  

相关文章:

  • 2021-11-07
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-04
  • 2021-08-21
  • 2021-11-04
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-28
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案