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



說明

java.time.LocalDate.hashCode() 方法獲取此日期的雜湊碼。

宣告

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

public int hashCode()

返回值

一個合適的雜湊碼。

示例

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

package com.tutorialspoint;

import java.time.LocalDate;

public class LocalDateDemo {
   public static void main(String[] args) {
	  
      LocalDate date = LocalDate.parse("2017-02-03");
      System.out.println(date.hashCode());  
   }
}

我們編譯並執行上述程式,它將產生如下結果 -

4130947
廣告
© . All rights reserved.