006-Java的break和continue
break 和 continue关键字的使用
break: 结束当前循环
continue:结束当次循环
示例如下
class JavaTest{ public static void main(String[] args){ //获取当前时间距离 1970-01-01 00:00:00的毫秒数 long start = System.currentTimeMillis(); System.out.println(start); label : for(int i = 1; i <= 4; i++){ System.out.print("第" + i + "次循环 :"); flag:for(int j = 1; j <= 5; j++){ if(j <= i){ System.out.print(j + " "); }else{ System.out.print("\n"); //break flag; continue flag; } } } } }