自定义异常
//自定义异常
class MyException extends Exception{
public MyException(String msg){
super(msg);
}
}
public class StringBufferDemo1 {
public static void main(String[] args) {
try{
throw new MyException("自定义异常");
}catch(MyException e){
e.printStackTrace();
}
}
}