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.