Java示例处理带有重载方法的异常


Java示例处理带有重载方法的异常

class NewClass1 {

   void msg()throws Exception{System.out.println("this is parent");}

}

public class NewClass extends NewClass1 {

   NewClass() {

   }

   void msg()throws ArithmeticException{System.out.println("This is child");}

   public static void main(String args[]) {

      NewClass1 n = new NewClass();

      try {

         n.msg();

      } catch(Exception e){}

   }  

}