package Java_Think;
class Except1 extends Exception {
      public Except1(String s) {
        super(s);
      }
    }
    class BaseWithException {
      public BaseWithException() throws Except1 {
        throw new Except1(
          "thrown by BaseWithException");
      }
    }
    class DerivedWE extends BaseWithException {
      // Gives compile error: 
      //    unreported exception Except1
      // ! public DerivedWE() {}
      // Gives compile error: call to super must be
      // first statement in constructor:
      //! public DerivedWE() {
      //!   try {
      //!     super();
      //!   } catch(Except1 ex1) {
      //!   }
      //! }
      public DerivedWE() throws Except1 {
          throw new Except1("feifei");
      }
    }
    public class E10_ConstructorExceptions {
      public static void main(String args[]) {
        try {
          new DerivedWE();
        } catch(Except1 ex1) {
          System.out.println("Caught " + ex1.getMessage());
        }
      }
    } 
为什么输出的结果是:Caught thrown by BaseWithException
而不是:Caught feifei
谢了!!!!!!

 
											





 
	    

