ZonedDateTime hashCode() method in Java with Examples Last Updated : 07 Dec, 2018 Comments Improve Suggest changes Like Article Like Report 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 searched with this unique code. Syntax: public ZoneId hashCode() Parameters: This method does not take any parameters. Return value: This method returns an integer value representing a suitable hash code. Below programs illustrate the hashCode() method: Program 1: Java // Java program to demonstrate // ZonedDateTime.hashCode() method import java.time.*; public class GFG { public static void main(String[] args) { // create a ZonedDateTime object ZonedDateTime zoneddatetime = ZonedDateTime.parse( "2018-12-06T19:21:12.123+05:30[Asia/Calcutta]"); // get hashcode int value = zoneddatetime.hashCode(); // print result System.out.println("hashcode:" + value); } } Output: hashcode:1966859253 Program 2: Java // Java program to demonstrate // ZonedDateTime.hashCode() method import java.time.*; public class GFG { public static void main(String[] args) { // create a ZonedDateTime object ZonedDateTime zoneddatetime = ZonedDateTime.parse( "1918-10-25T23:12:38.543+02:00[Europe/Paris]"); // get hashcode int value = zoneddatetime.hashCode(); // print result System.out.println("hashcode:" + value); } } Output: hashcode:1110445649 Reference: https://docs.oracle.com/javase/10/docs/api/java/time/ZonedDateTime.html#hashCode() Comment More infoAdvertise with us Next Article ZonedDateTime hashCode() method in Java with Examples A AmanSingh2210 Follow Improve Article Tags : Java Java-Functions Java-time package Java-ZonedDateTime 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 ZoneOffset hashCode() method in Java with Examples 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 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 OffsetDateTime hashCode() method in Java with examples The hashCode() method of OffsetDateTime class in Java is used to get a hash code for this date-time instance. Syntax : public int hashCode() Parameter : This method accepts does not accepts any parameter. Return Value: It returns a suitable hash code. Below programs illustrate the hashCode() method: 1 min read Writer hashCode() method in Java with Example The hashCode() method of Writer Class in Java is used to get the HashCode value of this Writer instance. This method does not accepts any parameter and returns the required int value. Syntax: public int hashCode() Parameters: This method accepts does not accepts any parameter. Return Value: This met 2 min read Like