fork download
  1. import java.time.Month;
  2. import java.time.format.TextStyle;
  3. import java.util.Locale;
  4.  
  5. public class Main {
  6. public static void main(String[] args) {
  7. for (int i = 1; i <= 12; i++) {
  8. Month month = Month.of(i);
  9. System.out.println(month.getDisplayName(TextStyle.FULL, Locale.ENGLISH) + " has a maximum of "
  10. + month.maxLength() + " days.");
  11. }
  12. }
  13. }
Success #stdin #stdout 0.18s 57952KB
stdin
Standard input is empty
stdout
January has a maximum of 31 days.
February has a maximum of 29 days.
March has a maximum of 31 days.
April has a maximum of 30 days.
May has a maximum of 31 days.
June has a maximum of 30 days.
July has a maximum of 31 days.
August has a maximum of 31 days.
September has a maximum of 30 days.
October has a maximum of 31 days.
November has a maximum of 30 days.
December has a maximum of 31 days.