package study; public class breakdemo {
public static void main(String[] args) {
System.out.println("1");
System.out.println("2");
System.out.println("3");
System.out.println("4");
System.out.println("5");
System.out.println("6");
System.out.println("7");
m1://标签,用于break跳出循环只能放在for前面或者后面,中间不能放语句
for (int i = 0; i < 5; i++) {
System.out.println("for"+i);
if (i==3) {
break m1;
}
} }
}