public class Break { public static void main(String[] args) { int i,j; STOP: for(i=1;i<=9;i++) { for(j=1;j<=i;j++) { if(i>4) { //break; 如果只是简单的break,只是跳出了内层循环,外层循环还在执行,会打印换行符 break STOP;//跳出外层循环 } System.out.print("*"); } System.out.print(" "); } } }