abstract int getLeastMaximum(int field)
描述 (Description)
java.util.Calendar.getLeastMaximum()()方法返回此Calendar实例的给定日历field的最小最大值。
声明 (Declaration)
以下是java.util.Calendar.getLeastMaximum()()方法的声明
public abstract int getLeastMaximum()(field)
参数 (Parameters)
field - 给定的日历字段。
返回值 (Return Value)
返回给定日历字段的最低最大值。
异常 (Exception)
NA
例子 (Example)
以下示例显示了java.util.calendar.getLeastMaximum()方法的用法。
package com.iowiki;
import java.util.*;
public class CalendarDemo {
public static void main(String[] args) {
// create a calendar
Calendar cal = Calendar.getInstance();
// get the days required in the first week of the year
System.out.println("Months required: " + cal.get(Calendar.MONTH));
// print the lowest maximum months for year.
int max = cal.getLeastMaximum(Calendar.MONTH);
System.out.println("Lowest maximum months :" + max);
}
}
让我们编译并运行上面的程序,这将产生以下结果 -
Months required: 4
Lowest maximum months :11