我打电话时有什么区别
calendar.get(Calendar.DATE);
calendar.get(Calendar.DAY_OF_MONTH);
calendar.set(Calendar.DATE, day);
calendar.set(Calendar.DAY_OF_MONTH, day);
?
答案 0 :(得分:3)
参见java.util.Calendar的api文档(重点是我的):
公共静态最终int DAY_OF_MONTH
get和set的字段编号,指示每月的日期。 这是DATE的同义词。该月的第一天的值为1。
“ Synonym”表示具有相同含义的单词。 这两个常数含义相同,并且可以互换。
此外,如果您查看代码,则会注意到这些常量定义为相同的值:
/**
* Field number for <code>get</code> and <code>set</code> indicating the
* day of the month. This is a synonym for <code>DAY_OF_MONTH</code>.
* The first day of the month has value 1.
*
* @see #DAY_OF_MONTH
*/
public final static int DATE = 5;
/**
* Field number for <code>get</code> and <code>set</code> indicating the
* day of the month. This is a synonym for <code>DATE</code>.
* The first day of the month has value 1.
*
* @see #DATE
*/
public final static int DAY_OF_MONTH = 5;