if else

    1. public static void main(String[] args) {
    2. Scanner sc =new Scanner(System.in);
    3. System.out.println("请输入一个年份,判断是闰年还是平年:");
    4. int year = sc.nextInt();
    5. if((year % 400 == 0) || (year % 100 != 0 )&&year % 4 == 0){
    6. System.out.println(year + "是闰年!");
    7. }else{
    8. System.out.println(year + "是平年!");
    9. }
    10. }