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



描述

java.time.Instant.hashCode() 方法返回此瞬時點的雜湊碼。

宣告

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

public int hashCode()

返回值

合適的雜湊碼。

示例

下列示例演示瞭如何使用 java.time.Instant.hashCode() 方法。

package com.tutorialspoint;

import java.time.Instant;

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

      Instant instant = Instant.now();
      System.out.println(instant.hashCode());
   }
}

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

1226468241
廣告
© . All rights reserved.