Java Calendar computeTime方法 Java Calendar computeFields 方法 Java示例-获得本地IP地址 Java Calendar computeTime方法 package com.codingdict; import java.util.*; public class CalendarDemo extends GregorianCalendar { public static void main(String[] args) { // create a new calendar CalendarDemo cal = new CalendarDemo(); // print the current date System.out.println("The current date is : " + cal.getTime()); // clear the calendar cal.clear(); // set a new year and call computeTime() cal.set(GregorianCalendar.YEAR, 1998); cal.computeTime(); // print the current date System.out.println("New date is : " + cal.getTime()); } } Java Calendar computeFields 方法 Java示例-获得本地IP地址