报出这样的错误:
"test.java": Error #: 360 : unreported exception: java.lang.Exception; must be caught or declared to be thrown at line 141, column 11为什么?

解决方案 »

  1.   

    恩,必须与try,catch搭配使用!!!
      

  2.   

    try{
        up;
    }catch(散分){
        接分;
    }
      

  3.   

    public void myMethod(String name) throws Exception{
    ......
    if(name.equalsIgnoreCase("a"))
       mycode1;
    else if (name.equalsIgnoreCase("b"))
       mycode2;
    else
      throw new Exception("类型不匹配");
    ......
    }
      

  4.   

    调用myMethod方法必须:
    try{
       myMethod("test");
    }catch(Exception e){
    }
      

  5.   


    try{
       
    }catch(Exception e){
    }
    使用控制异常