本文共 356 字,大约阅读时间需要 1 分钟。
/*while 循环while(表达式){} 如果表达式为true 继续执行,否则退出循环*/public class Test1 { /** * @param args the command line arguments */ public static void main(String[] args) { // 输出 1 - 5 之间(包括 1,5 本身)的数. int n=1; while(n<=5) // while 判断条件true 执行循环代码, 否则终止循环 { System.out.println(n); n++; } }}
转载地址:http://vehal.baihongyu.com/