Java tutorial
import java.time.Month; import java.time.YearMonth; public class Main { public static void main(String[] argv) { YearMonth currentYearMonth = YearMonth.now(); System.out.printf("Days in month year %s: No of days: %s \n", currentYearMonth, currentYearMonth.lengthOfMonth()); YearMonth creditCardExpiry = YearMonth.of(2018, Month.FEBRUARY); System.out.printf("Your credit card expires on %s: No of days: %s \n", creditCardExpiry, creditCardExpiry.lengthOfMonth()); } }