标题:[求助]java的一个问题
取消只看楼主
awxplayer
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2007-5-31
 问题点数:0 回复次数:1 
[求助]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); 找不到符号
求助各位大大,谢谢
2007-05-31 12:47
awxplayer
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2007-5-31
得分:0 

解决了,谢谢

2007-05-31 13:05



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-143792-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 1.744229 second(s), 10 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved