DateFormat hashCode() method in Java with Examples Last Updated : 27 Mar, 2019 Comments Improve Suggest changes Like Article Like Report The hashCode() Method of DateFormat class is used to return the hash code value of this DateFormat object. The hash code is of integer type. Syntax: public int hashCode() Parameters: The method does not take any parameters. Return Value: The method returns the hash code value of this DateFormat object and is of integer type. Below programs illustrate the working of hashCode() Method of DateFormat: Example 1: Java // Java to illustrate hashCode() method import java.text.*; import java.util.*; public class DateFormat_Demo { public static void main(String[] args) { // Initializing DateFormat DateFormat DFormat = DateFormat.getDateTimeInstance(); // Displaying the formats Date date = new Date(); String str_Date1 = DFormat.format(date); System.out.println("The Original: " + (str_Date1)); // Displaying the hash code System.out.println("The hash code: " + DFormat.hashCode()); } } Output: The Original: Mar 27, 2019 10:20:51 AM The hash code: 2034585966 Example 2: Java // Java to illustrate hashCode() method import java.text.*; import java.util.*; public class DateFormat_Demo { public static void main(String[] args) { // Initializing DateFormat DateFormat DFormat = new SimpleDateFormat("MM/dd/yyyy"); // Displaying the formats Date date = new Date(); String str_Date1 = DFormat.format(date); System.out.println("The Original: " + (str_Date1)); // Displaying the hash code System.out.println("The hash code: " + DFormat.hashCode()); } } Output: The Original: 03/27/2019 The hash code: 2087096576 Reference: https://docs.oracle.com/javase/7/docs/api/java/text/DateFormat.html#hashCode() Comment More infoAdvertise with us Next Article DateFormat hashCode() method in Java with Examples chinmoy lenka Follow Improve Article Tags : Misc Java Java - util package Java-Functions Java-DateFormat +1 More Practice Tags : JavaMisc Similar Reads Date hashCode() method in Java with Examples The hashCode() method of Java Date class returns a value which is a hash code for this object. Syntax: public int hashCode() Parameters: The function does not accept any parameter. Return Value: It returns a hashCode value for this object. Exception: The function does not throws any exception. Progr 2 min read ChoiceFormat hashCode() method in Java with Examples The hashCode() method of java.text.ChoiceFormat class is used to get the hash code for choice format object. This hashcode value is returned as an integer. Syntax: public int hashCode() Parameter: This method does not accept any parameter. Return Value: This method returns hash code for choice forma 2 min read Duration hashCode() method in Java with Examples The hashCode() method of Duration Class in java.time package is used to get the hashCode value of this duration. Syntax: public int hashCode() Parameters: This method do not accepts any parameter. Return Value: This method returns an int value which is the hashCode value of this duration. Below exam 1 min read Byte hashCode() method in Java with examples The hashCode() method of Byte class is a built in method in Java which is used to return the hash code of the ByteObject. Note: The hashCode() returns the same value as intValue(). Syntax ByteObject.hashCode() Return Value: It return an int value which represents the hashcode of the specified Byte o 2 min read BitSet hashCode Method in Java with Examples The hashCode() Method of BitSet class in Java is used to fetch the hash code value of a particular this BitSet. This returned hash codes value depends on the set bits of the bit set being passed. Syntax: BitSet.hashCode() Parameters: The method does not accept any parameters. Return Value: The metho 2 min read Charset hashCode() method in Java with Examples The hashCode() method is a built-in method of the java.nio.charset returns the computed hashcode of any given charset. Syntax: public final int hashCode() Parameters: The function does not accepts any parameter. Return Value: The function returns the computed hashcode for the charset. Below is the i 1 min read AbstractList hashCode() method in Java with Examples The hashCode() method of java.util.AbstractList class is used to return the hash code value for this list. Syntax: public int hashCode() Returns Value: This method returns the hash code value for this list. Below are the examples to illustrate the hashCode() method. Example 1: Java // Java program t 2 min read Collator hashCode() method in Java with Example The hashCode() method of java.text.Collator class is used to get the hashCode for this Collator object. Syntax: public abstract int hashCode() Parameter: This method does not accept any parameter.Return Value: This method returns hash code value in integer format. Below are the examples to illustrat 2 min read ByteBuffer hashCode() method in Java with Examples The hashCode() method of java.nio.ByteBuffer class is used to return the current hash code of this buffer. The hash code of a byte buffer depends only upon its remaining elements; that is, upon the elements from position() up to, and including, the element at limit() - 1. Because buffer hash codes a 2 min read Calendar hashCode() Method in Java with Examples The hashCode() method in Calendar class is used to return the hash code for this Calendar Object.Syntax: public int hashCode() Parameters: The method does not take any parameters.Return Value: The method returns the hash code value for this calendar object..Below programs illustrate the working of h 2 min read Like