首页 > 编程知识 正文

自定义异常 RuntimeException,java定义异常

时间:2023-05-06 08:03:24 阅读:202841 作者:1743

自定义异zqdzm /** * 自定义异常 */public class AppException extends RuntimeException { private static final long serialVersionUID = 1L; private String msg; private int code = 500; public AppException(String msg) { super(msg); this.msg = msg; } public AppException(String msg, Throwable e) { super(msg, e); this.msg = msg; } public AppException(String msg, int code) { super(msg); this.msg = msg; this.code = code; } public AppException(String msg, int code, Throwable e) { super(msg, e); this.msg = msg; this.code = code; } public String getMsg() { return msg; } public void setMsg(String msg) { this.msg = msg; } public int getCode() { return code; } public void setCode(int code) { this.code = code; }}

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。