int getMinimalDaysInFirstWeek()
描述 (Description)
java.util.Calendar.getMinimalDaysInFirstWeek()方法获得所需年份的第一周所需的最少天数。
声明 (Declaration)
以下是java.util.Calendar.getMinimalDaysInFirstWeek()方法的声明
public int getMinimalDaysInFirstWeek()
参数 (Parameters)
NA
返回值 (Return Value)
该方法返回一年中第一周所需的最小天数。
异常 (Exception)
NA
例子 (Example)
以下示例显示了java.util.calendar.getMinimalDaysInFirstWeek()方法的用法。
package com.iowiki;
import java.util.*;
public class CalendarDemo {
public static void main(String[] args) {
// create a calendar
Calendar cal = Calendar.getInstance();
// get what the minimal days required in the first week of the year
int i = cal.getMinimalDaysInFirstWeek();
// print the result
System.out.println("Minimal days required :" + i);
}
}
让我们编译并运行上面的程序,这将产生以下结果 -
Minimal days required :4