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



說明

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

宣告

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

public int hashCode()

返回值

一個合適的雜湊碼。

示例

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

package com.tutorialspoint;

import java.time.LocalDateTime;

public class LocalDateTimeDemo {
   public static void main(String[] args) {
 
      LocalDateTime date = LocalDateTime.parse("2017-02-03T12:30:30");
      System.out.println(date.hashCode());  
   }
}

讓我們編譯並執行上面的程式,它將生成以下結果:-

1561877623
廣告
© . All rights reserved.