public class AppException extends RuntimeException{
public AppException (String msg){
super(msg);
}
}public static void main(String[] args) {
try {
aa();
} catch (Exception e) {
if(e instanceof AppException) {
System.out.println(e.getMessage());
}
}
}public static void aa() {
try {
String s=null;
System.out.println(s.toString());
} catch (Exception e) {
throw new AppException("空指针异常");
}
}