问答题

请在每条横线处填写一个语句,使程序的功能为:判断输入的年份是否为闰年(例如:1998年不是闰年,2000年是闰年). 注意:请勿改动main()主方法和其他已有的语句内容,仅在横线处填入适当的语句。 import java.io.*; public class LeapYear{ public static void main(String args[]){ ___________________; BufferedReader in; ir=new InputStreamReader(_____________________________); in=new BufferedReader(ir); System. out. print In("输入年份是: "); String s=in.readline(); int year=___________________ if(year%4==0&&year%100!=0||year%400==0 System.out.println(" "+year+" "年是闰年. "); else System.out.println(" " +year+ " "年不是闰年."); } } }

【参考答案】

InputStreamReader ir; System.in Integer.parseInt(S);[解析] 本题主......

(↓↓↓ 点击下方‘点击查看答案’看完整答案 ↓↓↓)
热门 试题