java自定义抛出的异常Exception

package com.zhanzhuang.exception;

public class CustomizeException {
public static void main(String[] args) {
judge();
} public static void judge() {
int a = 2;
int b = 1;
if (a > b) {
try {
throw new MyException("true");
} catch (MyException e) {
e.printStackTrace();
}
} else {
try {
throw new MyException("false");
} catch (MyException e) {
e.printStackTrace();
}
}
}
} class MyException extends Exception { public MyException(String message) {
super(message);
}
}
上一篇:Python:使用基于事件驱动的SAX解析XML


下一篇:ZOJ 1092 Arbitrage