日期:2014-05-20  浏览次数:20751 次

JAVA初学者异常问题
public   class   Employee{
      public   static   void   main(String[]   args)     {
             
              try
              {
                      fangfa();
              }
             
              catch(ArrayIndexOutOfBoundsException   e)
              {
                      System.out.println( "ArrayIndexOutOfBoundsException抓到异常! ");
                      throw   e;
              }
             
              catch(Exception   a)
              {
                      System.out.println( "Excetption抓到异常了! ");
              }

      }
      public   static   void   fangfa()   throws   ArrayIndexOutOfBoundsException
      {
              throw   new   ArrayIndexOutOfBoundsException();
      }
}


这些代码咋运行出错了?   谁告诉我一下。谢谢!


------解决方案--------------------
如果你想捕捉throw e 处的异常,需再写一份try catch块