最近刚学异常产生疑问:
class LingException extends RuntimeException{
LingException(String s){
super(s);
}
}
class Text{
void show(int x)throws LingException {//这里的throws是声明异常吧?
if(x==0){
throw new LingException("分母不能为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);
}
}