[英]What does “synonym” mean in Java?
I read the JAVA API Document from http://docs.oracle.com/javase/8/docs/api/ . 我从http://docs.oracle.com/javase/8/docs/api/阅读了JAVA API文档。 For calendar class, there is the following paragraph:
对于日历类,有以下段落:
DAY_OF_MONTH
DAY_OF_MONTH
public static final int DAY_OF_MONTH
公共静态最终int DAY_OF_MONTH
Field number for get and set indicating the day of the month.
get和set的字段编号,指示每月的日期。 This is a synonym for DATE.
这是DATE的同义词。 The first day of the month has value 1.
该月的第一天的值为1。
See Also:
也可以看看:
DATE, Constant Field Values
DATE,常量字段值
I hardly understand the description, especially confused by the word "synonym". 我几乎不理解该描述,尤其是与“同义词”一词相混淆。 I will really appreciate it if anyone could explain this paragraph to me.
如果有人可以向我解释这一段,我将不胜感激。
A synonym is : 同义词是 :
synonym noun .
同义词 名词 。 1. a word having the same or nearly the same meaning as another in the language, as happy, joyful, elated.
1.与另一个语言具有相同或几乎相同的含义的单词,如快乐,快乐,兴高采烈。 A dictionary of synonyms and antonyms (or opposites).
同义词和反义词(或反义词)的字典。 2. (...)
2.(...)
So it means something has a different (field)name to refer to the same thing . 因此,这意味着某事物具有不同的(字段)名称来引用同一事物 。
So the documentation specifies that if you call Calendar.DAY_OF_MONTH
or Calendar.DATE
. 因此,文档指定了如果您调用
Calendar.DAY_OF_MONTH
或Calendar.DATE
。 you will always obtain the same value . 您将始终获得相同的值 。
We can verify this when we look at the documentation for Calendar
: 当我们查看
Calendar
的文档时,我们可以验证这一点:
static int DATE
Field number for get and set indicating the day of the month.
get和set的字段编号,指示每月的日期。
static int DAY_OF_MONTH
Field number for get and set indicating the day of the month.
get和set的字段编号,指示每月的日期。
The documentation for both fieds is exactly the same . 这两个领域的文档完全相同 。
Synonym means having same meaning. 同义词意味着具有相同的含义。
In the source code of Calendar
: 在
Calendar
的源代码中:
/**
* 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;
Here both values are 5, so both are same. 这两个值均为5,因此两者相同。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.