java吧 关注:1,300,753贴子:12,844,670
  • 1回复贴,共1

java新群招人可以为菜鸟解答疑惑

只看楼主收藏回复

JAVA新人快加入.群号:


1楼2008-03-22 20:10回复
    • 60.30.96.*
    说14行出错了啊,谢谢啊,号码呢


    class MyException extends Exception{
     private int detail;
     MyException( int a ){
     detail=a;
     }
     public String toString(){
     return "MyException "+detail;
     }
    }
    public class ExceptionDemo1{
     static void compute(int a) throws MyException{
     System.out.println("调用compute("+a+")");
     if(a>10)
     throw new Exception(a);
     System.out.println("这是正常退出");
     }
     public static void main(String args[]){
     try{
     compute(1);
     compute(2);
     }
     catch(MyException e){
     System.out.println("此处捕获了"+e);
     }
     }
    }


    2楼2008-03-22 20:24
    回复