Java中日历类(CalendarClass)的用途??
杨钦贵 2021-01-18 10:58 java.util.Calendar.getActualMaximum() 方法返回基于此Calendar的时间值,指定日历字段可能拥有的最大值。示例演示java.util.calendar.getActualMaximum()方法的用法。import java.util.*;public class CalendarDemo {public static void main(String[] args) {// create a calendarCalendar cal = Calendar.getInstance();// get the maximum value that year field can haveint i = cal.getActualMaximum(Calendar.YEAR);System.out.println("Maximum year:" + i);// get the maximum value that month field can h开发者_Python百科aveint a = cal.getActualMaximum(Calendar.MONTH);System.out.println("Maximum month:" + a);}}编译和运行上面的程序,这将产生以下结果:Maximum year:292278994Maximum month:11
精彩评论