Java.util.GregorianCalendar.add() 方法 Java.util.EnumMap.values() 方法 Java.util.GregorianCalendar.clone() 方法 Java.util.GregorianCalendar.add() 方法 package com.codingdict; import java.util.*; public class GregorianCalendarDemo { public static void main(String[] args) { // create a new calendar GregorianCalendar cal = (GregorianCalendar) GregorianCalendar.getInstance(); // print the current date and time System.out.println("" + cal.getTime()); // add 2 months cal.add((GregorianCalendar.MONTH), 2); // print the modified date and time System.out.println("" + cal.getTime()); // add 2 years cal.add((GregorianCalendar.YEAR), 2); // print the modified date and time System.out.println("" + cal.getTime()); } } Java.util.EnumMap.values() 方法 Java.util.GregorianCalendar.clone() 方法