break强制退出循环
continue终止某次循环,循环体内continue之后的语句不执行,接着执行下一次循环
break强制退出循环
continue终止某次循环,循环体内continue之后的语句不执行,接着执行下一次循环
package test.operator;
public class continueDemo01{
public static void main(String[] args) {
int i = 0;
while (i<100){
i++;
//遇到整十数换行
if(i%10 == 0){
System.out.println(i);
continue;
}
System.out.print(i+"\t");
}
}
}
package test.operator;
public class breakDemo01 {
public static void main(String[] args) {
int i = 0;
while (i<100){
i++;
System.out.print(i+"\t");
//打印30之前的数字
if(i==30){
break;
}
}
}
}
标签:int,break,关键字,continue,static,public,循环
From: https://www.cnblogs.com/sara0618/p/17227876.html