对同一内容次数的循环:
public class AAJ {
public static void main(String[] args) {
first: {
second: {
third: {
for (int i = 0; i < 3; i++) {
System.out.println("third"+i);
if (i == 2)
break second;
}
}
System.out.println("在second语句块中");
}
}
}
}
输出结果为 :
third0
third1
third2