Java 使用重载方法处理异常1


Java 使用重载方法处理异常1

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) {}
   }  
}