Java Calendar getMaximum方法


Java Calendar getMaximum方法

package com.codingdict;

import java.util.*;

public class CalendarDemo {
   public static void main(String[] args) {

      // create a calendar
      Calendar cal = Calendar.getInstance();

      // return the maximum value for days
      int max = cal.getMaximum(Calendar.DAY_OF_WEEK);
      System.out.println("Maximum days  :" + max);

      // return the maximum value for months
      max = cal.getMaximum(Calendar.MONTH);
      System.out.println("Maximum months  :" + max);
   }
}