class SimpleException extends Exception { }
class RecommendExc extends RuntimeException {
//推荐的构造函数
public RecommendExc () { }
public RecommendExc(String message) {
super(message);
}
//... 其他任何成员
}
try {
throw new SimpleException();
} catch (SimpleException e) {
System.out.println("caught " + e);
}
throw new RecommendExc("exeption"); //<-Error