import java.util.*;
class CalendarDemo
{
public static void main(String[] args)
{
Calendar c=Calendar.getInstance();
//c.set(2012,2,23);
//往后推
c.add(Calendar.MONTH,1);
printCalendat(c);
}
public static void printCalendat(Calendar c)
{
String[] mons={"一月","二月","三月","四月",
"五月","六月","七月","八月",
"九月","十月","十一月","十二月"};
String[] week={"","星期天","星期一","星期二","星期三","星期四","星期五","星期六"};
int index=c.get(Calendar.MONTH);
int week1=c.get(Calendar.DAY_OF_WEEK);
sop(c.get(Calendar.YEAR));
sop(mons[index]);
sop(week[week1]);
}
public static void sop(Object obj)
{
System.out.println(obj);
}
}
|