java.time.ZoneOffset.hashCode() Method Example



Description

The java.time.ZoneOffset.hashCode() method gets a hash code for this time-zone ID.

Declaration

Following is the declaration for java.time.ZoneOffset.hashCode() method.

public int hashCode()

Return Value

a suitable hash code.

Example

The following example shows the usage of java.time.ZoneOffset.hashCode() method.

package com.tutorialspoint;

import java.time.ZoneOffset;

public class ZoneOffsetDemo {
   public static void main(String[] args) {
 
      ZoneOffset zone = ZoneOffset.of("Z");
      System.out.println(zone.hashCode());  
   }
}

Let us compile and run the above program, this will produce the following result −

0
Advertisements