private String reason;
public MyDateException (String r) {
reason=r;
}
public String getReason(){
return(reason);
}
}
class Mydate{
int yeat,month,day;
void setDay(int y,int m,int d){
if(d>31){
throw new MyDateException("day too big");
}
}
}
class ab{
public static void main(String[] tt){
Mydate b=new Mydate();
try{
b.setDay(2001,12,123);
}
catch(MyDateException v){
System.out.println(v.getReason());
}
}
}
在这个java程序中他的错误提示在14行:
unreported exception MyDateException; must be caught or declared to be thrown
我一直找不处错误请各位帮帮小弟这个忙
小弟不胜感激



