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



說明

java.time.MonthDay.hashCode() 方法獲取此月日的一個雜湊碼。

宣告

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

public int hashCode()

返回值

一個合適的雜湊碼。

示例

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

package com.tutorialspoint;

import java.time.MonthDay;

public class MonthDayDemo {
   public static void main(String[] args) {
 
      MonthDay time = MonthDay.parse("--12-30");
      System.out.println(time.hashCode());  
   }
}

讓我們編譯並執行以上程式,這將產生以下結果 −

798
廣告