Java.util.Calendar.isLenient() 方法
描述
java.util.Calendar.isLenient() 方法告诉日期和时间解释是否要宽松。
声明
以下是 java.util.Calendar.isLenient() 方法的声明
public boolean isLenient()
参数
NA
返回值
true 如果解释模式是宽松的; 如果不是,false。
异常
NA
示例
下面的例子展示了 java.util.calendar.isLenient() 方法的使用。
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);
}
}
让我们编译并运行上面的程序,这将产生以下结果 −
Current Date and Time is Sat May 05 17:06:13 EEST 2012 Interpretation is lenient: true

