java.time.YearMonth.hashCode()方法

java.time.YearMonth.hashCode()方法返回此YearMonth的哈希码。

声明

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

public int hashCode()

返回值

合适的哈希码。

示例

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

package com.zaixian;

import java.time.YearMonth;

public class YearMonthDemo {
   public static void main(String[] args) {

      YearMonth date = YearMonth.of(2017,12);
      System.out.println(date.hashCode());
   }
}

编译并运行上面的程序,这将产生以下结果 -

1610614753

上一篇: java.time.YearMonth类 下一篇: java.time.ZonedDateTime类