“同义词”在Java中是什么意思?
我阅读了来自http://docs.oracle.com/javase/8/docs/api/的JavaAPI文档。对于日历类,有以下段落:
DAY_OF_MONTH
public static final int DAY_OF_MONTH
Field 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.
See Also:
DATE, Constant Field Values
我几乎听不懂描述,尤其是被“同义词”这个词弄糊涂了。如果有人能向我解释这段话,我将不胜感激
# 1 楼答案
同义词的意思是有相同的意思
在
Calendar
的源代码中:这里两个值都是5,所以都是相同的
# 2 楼答案
A synonym is:
因此,它意味着某物有一个不同的(字段)名称来表示同一事物
因此,文档指定如果调用
Calendar.DAY_OF_MONTH
或Calendar.DATE
。您将始终获得相同的值我们可以在查看documentation for ^{} 时验证这一点:
两个场的文档完全相同