「Java」例外Exceptionクラスを継承するサンプル
書式
public class クラス名 extend Exception
使用例
1.Exceptionクラスの継承
public class ErrData extends Exception {
/**メッセージ**/
private String msg = null;
public ErrData(String target) {
super(target + "not exist");
msg = target;
}
public String getTarget() {
return msg;
}
}
2.使い方
if(条件式){
throw ErrData(xxx);
}