java6--while循环

    技术2022-07-11  115

    1: 2:例子

    package java1; public class java3 { public static void main(String[] args) { int i=1;//初始化 while(i<=10)//每轮开始之前,判断条件是否成立 { System.out.print(i + " "); i++; } } } /*1 2 3 4 5 6 7 8 9 10 Process finished with exit code 0 */

    3:例子

    package java1; public class java3 { public static void main(String[] args) { int i = 1;//初始化 while (true) { if (i > 10) { break; } System.out.print(i + " "); i++; } } } /*1 2 3 4 5 6 7 8 9 10 Process finished with exit code 0 */
    Processed: 0.009, SQL: 9