break、continue关键字的使用
举例break
public class test02 {
public static void main(String[] args) {
for (int i = 1;i<=10;i++){
if(i%4==0){
break;
}
System.out.print(i);
}
}
}
结果
举例continue
public class test02 {
public static void main(String[] args) {
for (int i = 1;i<=10;i++){
if(i%4==0){
continue;
}
System.out.print(i);
}
}
}
结果