Java Calendar setLenient方法


Java Calendar setLenient方法

package com.codingdict;

import java.util.*;

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

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

      // print current state of lenient
      boolean b = cal.isLenient();
      System.out.println("Calendar is lenient :" + b);

      // change lenient state
      cal.setLenient(false);

      // print result
      System.out.println("Lenient after setting :" + cal.isLenient());
   }
}