Java Date Time - Period hashCode() example








Period hashCode() returns a hash code for this period.

Syntax

hashCode has the following syntax.

public int hashCode()

Example

The following example shows how to use hashCode.

import java.time.Period;
// w w  w .  j  a  v  a2s  .c  o  m
public class Main {
  public static void main(String[] args) {
    Period p = Period.ofDays(12);

    System.out.println(p.hashCode());

  }
}

The code above generates the following result.