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.