目录

boolean equals(Object otherYearMonth)

描述 (Description)

java.time.YearMonth.equals(YearMonth otherYearMonth)方法检查此YearMonth是否等于指定的YearMonth。

声明 (Declaration)

以下是java.time.YearMonth.equals(YearMonth otherYearMonth)方法的声明。

public int equals(YearMonth otherYearMonth)

参数 (Parameters)

otherYearMonth - 另一个YearMonth,null返回false。

返回值 (Return Value)

如果其他YearMonth等于此,则为true。

例子 (Example)

以下示例显示了java.time.YearMonth.equals(YearMonth otherYearMonth)方法的用法。

package com.iowiki;
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
↑回到顶部↑
WIKI教程 @2018