集册 Java实例教程 扩展异常类的MyException类

扩展异常类的MyException类

欢马劈雪     最近更新时间:2020-01-02 10:19:05

470
扩展异常类的MyException类

public class Main {

  public void m1() throws MyException {

    // Code for m1() body goes here

    try {/*时代Java公众号 提 供*/

      // Code for the try block goes here

      throw new MyException();

    } catch (MyException e) {

      // Code for the catch block goes here

    }


  }


}


class MyException extends Exception {

  public MyException() {

    super();

  }/*来自 nowjava*/


  public MyException(String message) {

    super(message);

  }


  public MyException(String message, Throwable cause)
展开阅读全文