本帖最后由 我为你着迷 于 2014-12-8 08:45 编辑
- import java.util.*;
- class CalendarDemo
- {
- 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(mons[index]);
- sop(c.get(Calendar.DAY_OF_MONTH)+"日");//月中的某一天
- sop(weeks[index1]);
- }
-
- public static void sop(Object obj)
- {
- System.out.println(obj);
- }
- }
复制代码
String[] weeks={"","星期日","星期一","星期二","星期三","星期四","星期五","星期六"}; 大家好 我想问下这胡话星期日的前边为什么加一个空内容的双引号啊 不懂 麻烦大神帮小弟解答下 谢谢 黑马币无线奉上啊 |