本帖最后由 刘俊佳 于 2012-7-6 08:40 编辑
这是代码:
package test;
import java.text.Format;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
public class RuntimeDemo {
public static void main(String[] args) {
Calendar c = Calendar.getInstance();
String[] mons = { "一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月",
"十月", "十一月", "十二月" };
String[] weeks = { "", "星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六" };
int index = c.get(Calendar.MONTH);
int index1 = c.get(Calendar.DAY_OF_WEEK);
sop(c.get(Calendar.YEAR) + "年");
// sop((c.get(Calendar.MONTH+1))+"月");
sop(mons[index]);
sop(c.get(Calendar.DAY_OF_MONTH) + "日");
// sop("星期"+c.get(Calendar.DAY_OF_WEEK));
sop(weeks[index1]);
}
public static void sop(Object obj) {
System.out.println(obj);
}
}
这里这个sop有什么作用?最好详细点。 |
|