请教各位大虾:如何修改,使程序可以通过编译,但又不注释掉"break stop"这一行.顺便问句:"break stop"的用法及要注意的问题.谢谢!!!!!!!!!!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,"Bingq123",JOptionPane.INFORMATION_MESSAGE);
     System.exit(0);
                   
   }
              }
      

解决方案 »

  1.   

    String output=""; 
    stop:
    做为掉转的标志,应该用“:”号。
    我编译了下,可以了。
      

  2.   


            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, "Bingq123", JOptionPane.INFORMATION_MESSAGE);
            System.exit(0);
      

  3.   

    我运行了下,没有结果呀。
    JOptionPane是javax.swing类库的。
    你需要在文件头加:
    import javax.swing.*;
    你的import javax.swing.JOptionPane; 
    就多余了。
    我是这么觉得的:)
      

  4.   

    就是4楼所说的问题,
    String 要 ; 结束
    stop 要   : 结束