- java.time 包类
- java.time - 主页
- java.time - 时钟
- java.time - 持续时间
- java.time - 时刻
- java.time - 本地日期
- java.time - 本地日期时间
- java.time - 本地时间
- java.time - 月日
- java.time - 偏移日期时间
- java.time - 偏移时间
- java.time - 周期
- java.time - 年
- java.time - 年月
- java.time - 区域日期时间
- java.time - 区域标识符
- java.time - 区域偏移量
- java.time 包枚举
- java.time - 月
- java.time 有用资源
- java.time - 讨论
java.time.YearMonth.equals() 方法示例
说明
**java.time.YearMonth.equals(YearMonth otherYearMonth)** 方法检查此 YearMonth 是否等于指定的 YearMonth。
声明
以下是 **java.time.YearMonth.equals(YearMonth otherYearMonth)** 方法的声明。
public int equals(YearMonth otherYearMonth)
参数
**otherYearMonth** - 另一个 YearMonth,null 返回 false。
返回值
如果另一个 YearMonth 等于此 YearMonth,则返回 true。
示例
以下示例显示了 java.time.YearMonth.equals(YearMonth otherYearMonth) 方法的使用。
package com.tutorialspoint;
import java.time.YearMonth;
public class YearMonthDemo {
public static void main(String[] args) {
YearMonth date = YearMonth.of(2005,11);
YearMonth date1 = YearMonth.of(2006,12);
System.out.println(date.equals(date1));
}
}
让我们编译并运行以上程序,这将产生以下结果 -
false
广告