[求助]java的一个问题
class MyException extends Exception{MyException(String ErrorMessage){
super(ErrorMessage);
}
}
public class Excep11{
static int avg(int a,int b) throws MyException{
if(a<0||b<0)
throw new MyException("error1");
else if(a>100||b>100)
throw new MyException("too large");
return (a+b)/2;
}
public static void main(String[] args){
try{
Excep11 aaa=new Excep11();
int y=aaa.avg(10,20);
}catch(MyException e){
System.out.println(e);
}
System.out.println(y);
}
}
提示21行System.out.println(y); 找不到符号
求助各位大大,谢谢