问答题
请在下画线处填写适当的语句,完成此程序使它能正确执行。
import java.io.*;
public class LeapYear{
public static void main(String args[])throws IOException{
inputStreamReader ir;
BufferedReader in;
ir=new InputStreamReader(System.in);
in=new BufferedReader(ir);
System.out.println("输入年份是:");
String s=in.readLine();
int year=Integer.parseInt(s);
______
{
System.out.println(" "+year+"年是闰年。");
}
else System.out.println(" "+year+"年不是闰年。");
}
}
【正确答案】if(year%4==0&&year%100!=0||year%400==0)
【答案解析】