Calendar setLenient() Method in Java with Examples
The setLenient(boolean leniency) method in Calendar class is used to specify whether the interpretation of the date and time is to be lenient or not.
public void setLenient(boolean leniency)
Parameters: The method takes one parameter leniency of the boolean type that refers to the mode of the calendar. The boolean value true turns on the leniency mode and false turns off the leniency mode.
Return Value: The method does not return any value.
Below programs illustrate the working of setFirstDayOfWeek() Method of Calendar class:
Is the Calendar lenient? true The altered Leniency: false
Current Calendar: Thu Feb 21 11:00:50 UTC 2019 Calendar is lenient? false Calendar is lenient: true
Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course.