定义一个变量指定循环上限,演示do-while语句的使用,并将结果打印到控制台。

package ch2;

public class DoWhileOP {

	public static void main(String[] args) {
		int count=5;//循环上限
		int i=1;//迭代指示器
		do{
			System.out.println("当前是:"+i);
			i++;
		}while(i<count);
	}

}

迭代结构2

相关文章:

  • 2021-11-20
  • 2022-12-23
  • 2021-11-19
  • 2021-06-24
  • 2021-07-13
  • 2021-09-03
  • 2021-11-20
猜你喜欢
  • 2021-04-24
  • 2021-10-01
  • 2022-12-23
  • 2022-12-23
  • 2021-10-03
  • 2021-12-31
相关资源
相似解决方案