?class MyException extends Exception {
?    private int exceptnumber;
?    MyException(int a) {
?        exceptnumber = a;
?    }
?    public String toString() {
?        return "自定义异常[" + exceptnumber + "]";           // 自定义异常的描述信息
?    }
?}
?class Example5_6 {
?    static void makeExcept(int a) throws MyException {
?        System.out.println("接收到的参数为：" + a);          // 输出接收到的参数
?        if (a == 0)
?            throw new MyException(a);                     // 抛出自定义异常MyException
?        System.out.println("没有捕获到任何异常");
?    }
 public static void main(String args[]) {
        try {
            makeExcept(5);
           makeExcept(0);
        }
        catch (MyException e) {                             // 捕获自定义异常MyException
           System.out.println("捕获" + e);
        }
   }
}