日期:2014-05-20  浏览次数:20751 次

关于GregorianCalendar类
System.out.println(GregorianCalendar.DAY_OF_MONTH);//输出怎么是5
API上说是 1 啊

------解决方案--------------------
java.util.Calendar
public static final int AM 0
public static final int AM_PM 9
public static final int APRIL 3
public static final int AUGUST 7
public static final int DATE 5
public static final int DAY_OF_MONTH 5
public static final int DAY_OF_WEEK 7
public static final int DAY_OF_WEEK_IN_MONTH 8
public static final int DAY_OF_YEAR 6
public static final int DECEMBER 11
 上面是API
看看等于几吧。。呵呵。
正确用法是System.out.println(now.get(now.DAY_OF_MONTH));
等价于System.out.println(now.get(GregorianCalendar.DAY_OF_MONTH));

------解决方案--------------------

我看过api之后的理解是跟楼主一样的!
DAY_OF_MONTH
public static final int DAY_OF_MONTHField number for get and set indicating the day of the month. This is a synonym for DATE. The first day of the month has value 1.
------解决方案--------------------
你输出它干吗?
------解决方案--------------------

API1.4
就和PI一样,就一常量。
------解决方案--------------------
神啊,图太多大了。。
直接输出没有意思,
用get来使用他。