(1)创建自定义异常
Class XException extends Exception{
public XEception(){
}
public XEception(String args){
super(args);
}
}
(2)抛出自定义异常
Class A{
Public String b;
Protected float c;
public void C(A a) throws XException{
if(a.c==0){
throw new XException();
}
}
}