plusDays method

অধিবর্ষ
অধিবর্ষ Java ট্র্যাকে
import java.time.*;

class Leap {

    boolean isLeapYear(int year) {
        return LocalDate.of(year, Month.FEBRUARY, 28).plusDays(1).getDayOfMonth() == 29;
    }
}

This approach may be considered a "cheat" for this exercise. By adding a day to February 28th for the year, you can see if the new day is the 29th or the 1st. If it is the 29th, then the year is a leap year. This is done by using the plusDays() and getDayOfMonth() methods of the LocalDate class.

23 সেপ্টেম্বর 2026 · কাজে লেগেছে?

Java ট্র্যাকে অধিবর্ষ অনুশীলনীর অন্য অ্যাপ্রোচগুলো

এই অনুশীলনীটি আমাদের কমিউনিটি যেভাবে অন্য ভাবেও সমাধান করেছে