package ssh;
import java.time.LocalDate;
public class Year1 {
public static void main(String[] args) {
//2023 是不是闰年?
int year = 2023;
//if语句判断是不是闰年
if (year % 400 == 0 || (year % 4 == 0 && year % 100 != 0)) {
System.out.println("闰年");
} else {
System.out.println("平年");
}
String y = LocalDate.of(year, 1, 1).isLeapYear() ? "闰年" : "平年";
System.out.println(info);
}
}
判断年份是否为闰年
于 2023-02-10 22:02:12 首次发布