java.time.YearMonth.hashCode() 方法示例



說明

java.time.YearMonth.hashCode() 方法返回針對此 YearMonth 的雜湊程式碼。

宣告

以下是 java.time.YearMonth.hashCode() 方法的宣告。

public int hashCode()

返回值

一個合適的雜湊程式碼。

示例

以下示例展示了 java.time.YearMonth.hashCode() 的使用。

package com.tutorialspoint;

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
廣告