break, continue循环控制语句
代码:
package com.yidu.test;
public class Love {
public static void main(String[] args) {
for (int i = 0; i < 5; i++) {
if (i == 3) {
break;//跳出for循环
}
System.out.println(i); }
}
}
package com.yidu.test;
public class Love {
public static void main(String[] args) {
for (int i = 0; i < 5; i++) {
if (i == 3) {
continue;//结束当前循环,当前之后的语句不执行了,而继续执行下一次循环
}
System.out.println(i); }
}
}