[Html]
Package com. itheima. date;
Import java. util. Calendar;
Public class CalendarDemo1 {
Public static void main (String [] args ){
Calendar c = Calendar. getInstance ();
C. set (2012, 11, 16); // set the time to start from 0, 0 --- January
C. add (Calendar. MONTH, 4); // incremental.
PrintCalendar (c );
}
Private static void sop (Object obj ){
System. out. println (obj );
}
Private static void printCalendar (Calendar c ){
/*
* Use the lookup table to obtain the Chinese month, week
*/
String [] mons = {"January", "August ", "September ",
"August October", "August November", "August December "};
String [] weeks = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday "};
Int index = c. get (Calendar. MONTH );
Int index1 = c. get (Calendar. DAY_OF_WEEK );
Sop (c. get (Calendar. YEAR) + "YEAR ");
// Sop (c. get (Calendar. MONTH) + 1) + "MONTH ");
Sop (mons [index]);
Sop (c. get (Calendar. DAY_OF_MONTH) + "day ");
// Sop ("Week" + c. get (Calendar. DAY_OF_WEEK ));
Sop (weeks [index1]);
}
}