1.继承现有异常结构,RuntimeException或者Exception
2.提供全局常量 : erialVersionUID
3.提供重载构造器
4.在项目中即可调用 throw MyException("不能。。。") ;
public class MyException extends RuntimeException{
static final long serialVersionUID = -7034897191215766939L ;
public MyException(){
}
public MyException(String msg){
super(msg);
}
标签:自定义,RuntimeException,MyException,msg,异常,public From: https://www.cnblogs.com/liujy2233/p/16860867.html