在finally中如果有异常,也需要try{}catch{}
或者将将出异常的输入流放入try{}中
public class TheDayInYear {
public static void main(String[] args) {
try (BufferedReader bf = new BufferedReader(new InputStreamReader(System.in)) ){
//录入键盘的数据
String str = bf.readLine();
//分割年月日
String[] strArr = str.split(".");
int year = Integer.parseInt(strArr[0]);
int month = Integer.parseInt(strArr[1]);
int day = Integer.parseInt(strArr[2]);
int twoMonth = 28;
//判断平年还是闰年
if((year%4==0&&year%100!=0) || (year%400==0)) {
}
}
catch (Exception e) {
System.out.println(e);
}
}
}