文件名称:Java课程设计案例精编
文件大小:2.04MB
文件格式:ZIP
更新时间:2014-11-13 12:19:10
Java课程设计案例精编t
import java.util.Calendar; class TestClassCalendar{ public static void main(String args[]){ Calendar mycalendar1 = Calendar.getInstance(); System.out.println("今日日期: "); System.out.print(mycalendar1.get(Calendar.YEAR) + "年"); System.out.print(mycalendar1.get(Calendar.MONTH) + "月"); System.out.println(mycalendar1.get(Calendar.DATE) + "日"); System.out.println("今日时间: "); System.out.print(mycalendar1.get(Calendar.HOUR) + ":"); System.out.print(mycalendar1.get(Calendar.MINUTE) + ":"); System.out.println(mycalendar1.get(Calendar.SECOND)); mycalendar1.set(Calendar.HOUR, 10); mycalendar1.set(Calendar.MINUTE, 29); mycalendar1.set(Calendar.SECOND, 22); System.out.println("将mycalendar1时间调整成为: "); System.out.print(mycalendar1.get(Calendar.HOUR) + ":"); System.out.print(mycalendar1.get(Calendar.MINUTE) + ":"); System.out.println(mycalendar1.get(Calendar.SECOND)); } }