java用异常处理

时间:2018-06-23 11:27:15
【文件属性】:
文件名称:java用异常处理
文件大小:554B
文件格式:TXT
更新时间:2018-06-23 11:27:15
java public void set(int year,int month,int day)throws DateFormatException { if(year<=-2000||year>2500) throw new DateFormatException(year+",年份不合适,有效年份为-2000~2500。"); if (month<1||month>12) throw new DateFormatException(month+"月,月份错误"); if(day<1||day>MyDate.daysOfMonth(year,month)) throw new DateFormatException(year+"年"+month+"月"+day+"日",日期错误”); }

网友评论