Built-in method

윤년
윤년 Java에서
import java.time.Year;

class Leap {

    boolean isLeapYear(int year) {
        return Year.of(year).isLeap();
    }
}

This may be considered a "wicked cheat" for this exercise, by simply passing the year into the isLeap() method of the Year class. Although it is not in the spirit of this exercise, isLeap() would be the idiomatic way to determine if a year is a leap year in the "real world".

2026년 09월 23일 · 유용했나요?