|
发表于 2004-4-9 01:43:22
|
显示全部楼层
import javax.swing.JOptionPane;
public class BreakLabelDemo{
public static void main(String args[])
{
String output="";
stop:
{
for(int row=1;row<=10;row++){
for(int column=1;column<=5;column++){
if(row==5)
break stop;
output+="* ";
}
output+="\n";
}
output+="\nLoops terminated normally";
}
JOptionPane.showMessageDialog(null,output,"Testing break with a",
JOptionPane.INFORMATION_MESSAGE);
System.exit(0);
}
}
这样就可以编译通过了,你的标号stop后是分号,应是冒号此时才代表标号,注意showMessageDialog方法的参数 |
|