本帖最后由 黑马-王鹏 于 2013-4-2 15:04 编辑
- import java.util.*;
- class CalendarDemo2
- {
- public static void main(String[] args)
- {
- Calendar c = Calendar.getInstance();
- printCalendar(c);
- }
- public static void printCalendar(Calendar c)
- {
- sop(c.get(Calendar.YEAR)+"年");
- sop((c.get(Calendar.MONTH)+1)+"月");
- sop(c.get(Calendar.DAY_OF_MONTH)+"日");
- sop("星期"+c.get(Calendar.DAY_OF_WEEK));
- }
- public static void sop(Object obj)
- {
- System.out.println(obj);
- }
- }
复制代码 file:///C:/Documents%20and%20Settings/wangpeng/桌面 |
|