java 异常问题
最近刚学异常产生疑问:
class weiLingException extends RuntimeException{
weiLingException(String s){
super(s);
}
}
class Text{
void show(int x)throws weiLingException {//这里的throws抛给谁
if(x==0){
throw new weiLingException("分母不能为0");//这里的throw又抛给谁
}
int s =3/x ;
System.out.println(s);
}
}
public class class1 {
public static void main(String[] args) {
Text t = new Text();
t.show(0);
}
}