package com.zhao.struct; public class BreakDemo { public static void
main(String[] args) { int i = 0; while (i<100){ i++; System.out.println(i); if
(i==30){ break; } } System.out.println("123"); } }
============================================
package com.zhao.struct; public class ContinueDemo { public static void
main(String[] args) { int i = 0; while (i<100){ i++; if (i%10==0){
System.out.println(); continue; } System.out.print(i); } } }
======================================
package com.zhao.struct; public class LabelDemo { public static void
main(String[] args) { //打印101-150之间所以的质数 //质数是指在大于1的自然数中,出了1和它本身以外不再有其他因素的自然数。
int count = 0; //不建议使用 outer:for (int i=101;i<150;i++){ for (int j =
2;j<i/2;j++){ if (i % j == 0){ continue outer; } } System.out.print(i+" "); } }
}