LeapYear.java【输入数字判断是平年还是瑞年】
import java.util.*; public class LeapYear{ public static void main(String [] args){ Scanner input=new Scanner(System.in); System.out.print("请输入需要查询的年份:"); int year=input.nextInt();//将键盘输入的值赋值给year变量 if(year%4==0&&year%100!=0||year%400==0){ System.out.println(year+"年是闰年。"); }else{ System.out.println(year+"年是平年。"); } } }