java.util.Calendar isLenient()

Description :

This java tutorial shows how to use the isLenient() method of Calendar class of java.util package. This method Tells whether date/time interpretation is to be lenient.

Method Syntax :

public boolean isLenient()

Parameter Input :

 

DataType Parameter Description
N/A N/A N/A

 

Method Returns :

This method returns true if the interpretation mode of this calendar is lenient; false otherwise.

Compatibility Version :

Requires Java 1.1 and up

Exception :

N/A

Java Code Example :

This java example source code demonstrates the use of isLenient() method of Calendar class.

package com.javatutorialhq.java.examples;

import java.util.Calendar;
import java.util.TimeZone;

/*
 * This example source code demonstrates the use of  
 * isLenient() method of Calendar class
 */

public class CalendarSetLenientExample {

	public static void main(String[] args) {

		Calendar cal = Calendar.getInstance();
		boolean result = cal.isLenient();
		System.out.println("Is calendar lenient?"+result);
		cal.setLenient(false);
		result = cal.isLenient();
		System.out.println("Is calendar lenient?"+result);

	}
}

Sample Output :

Running the isLenient() method example source code of Calendar class will give you the following output:

Is calendar lenient?true
Is calendar lenient?false

Exception Scenario :

N/A

Similar Method :

  • N/A

Suggested Reading List :

References :