Java.util.Calendar.isLenient() Method



Description

The java.util.Calendar.isLenient() method tells if date and time interpretation are to be lenient.

Declaration

Following is the declaration for java.util.Calendar.isLenient() method

public boolean isLenient()

Parameters

NA

Return Value

true if the interpretation mode is lenient; false if it is not.

Exception

NA

Example

The following example shows the usage of java.util.calendar.isLenient() method.

package com.tutorialspoint;

import java.util.*;

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

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

      // displays the current calendar
      System.out.println("Current Date and Time is " + cal.getTime());

      // tells whether date/time interpretation is lenient.
      boolean b = cal.isLenient();
      System.out.println("Interpretation is lenient: " + b);
   }
}

Let us compile and run the above program, this will produce the following result −

Current Date and Time is Sat May 05 17:06:13 EEST 2012
Interpretation is lenient: true
java_util_calendar.htm
Advertisements