ZoneOffset hashCode() method in Java with Examples Last Updated : 11 Dec, 2018 Comments Improve Suggest changes Like Article Like Report The hashCode() method of ZoneOffset Class in java.time package is used to obtain hashCode value of this instance of ZoneOffset. This method does not takes any parameter and returns an int value. which is the hashCode value. Syntax: public static int hashCode() Parameters: This method accepts do not accepts any parameter. Return Value: This method returns an int value which is the hashCode value of this ZoneOffset instance. Below examples illustrate the ZoneOffset.hashCode() method: Example 1: Java // Java code to illustrate hashCode() method import java.time.*; public class GFG { public static void main(String[] args) { // Get the ZoneOffset ZoneOffset zoneOffset = ZoneOffset.ofHours(5); System.out.println(zoneOffset); // Using hashCode() method int hashCode = zoneOffset.hashCode(); System.out.println("ZoneOffset hashCode: " + hashCode); } } Output: +05:00 ZoneOffset hashCode: 18000 Example 2: Java // Java code to illustrate hashCode() method import java.time.*; public class GFG { public static void main(String[] args) { // Get the ZoneOffset ZoneOffset zoneOffset = ZoneOffset.of("Z"); System.out.println(zoneOffset); // Using hashCode() method int hashCode = zoneOffset.hashCode(); System.out.println("ZoneOffset hashCode: " + hashCode); } } Output: Z ZoneOffset hashCode: 0 Reference: Oracle Doc Comment More infoAdvertise with us Next Article ZoneOffset hashCode() method in Java with Examples C code_r Follow Improve Article Tags : Java Java-Functions Java-time package Java-ZoneOffset Practice Tags : Java Similar Reads ZoneId hashCode() method in Java with Examples The hashCode() method of the ZoneId class in Java is used to return unique hashcode for this ZoneId. Syntax: public int hashCode(Object obj) Parameters: This method accepts nothing. Return value: This method returns an int which represents the hashCode. Below programs illustrate the hashCode() metho 1 min read ZoneOffsetTransition hashCode() method in Java with Example The hashCode() method of java.time.zone.ZoneOffsetTransition class is used to get the hash code for the zone offset transition object. Syntax: public int hashCode() Parameter: This method does not accept any parameter. Return Value: This method returns the hash code for the zone offset transition ob 2 min read ZonedDateTime hashCode() method in Java with Examples The hashCode() method of a ZonedDateTime class is used to get the hashcode for this ZonedDateTime. Hashcode is a unique code generated by the JVM at time of object creation. It can be used to perform some operation on hashing related algorithm like hashtable, hashmap etc. An object can also be searc 1 min read Year hashCode() method in Java with Examples The hashCode() method of Year class in Java is used to get a suitable hash code for the current Year object. Syntax: public int hashCode() Parameter: This method does not accepts any parameter. Return Value: It returns a suitable integral hash code for the year object with which it is used. It never 1 min read ZoneOffsetTransitionRule hashCode() method in Java with Example The hashCode() method of java.time.zone.ZoneOffsetTransitionRule class is used to get the hash code of this zone offset transition rule object. Syntax: public int hashCode() Parameter: this method does not accept any parameter. Return Value: This method returns the hash code of this zone offset tran 2 min read Like