NumberFormat hashCode() method in Java with Examples Last Updated : 11 Jul, 2025 Summarize Comments Improve Suggest changes Share Like Article Like Report The hashCode() method is a built-in method of the java.text.NumberFormat returns a hash-code value for this given object of instance. Syntax: public int hashCode() Parameters: The function does not accepts any parameter. Return Value: The function returns the hash-code value. Below is the implementation of the above function: Program 1: Java // Java program to implement // the above function import java.text.NumberFormat; import java.util.Locale; import java.util.Currency; public class Main { public static void main(String[] args) throws Exception { // Get the instance for Locale US NumberFormat nF = NumberFormat .getInstance(Locale.US); // Prints the hash-code value System.out.println("The hash-code values is: " + nF.hashCode()); } } Output: The hash-code values is: 423132 Program 2: Java // Java program to implement // the above function import java.text.NumberFormat; import java.util.Locale; import java.util.Currency; public class Main { public static void main(String[] args) throws Exception { // Get the instance for Locale US NumberFormat nF = NumberFormat .getInstance(Locale.US); // Prints the hash-code value System.out.println("The hash-code values is: " + nF.hashCode()); } } Output: The hash-code values is: 423132 Reference: https://docs.oracle.com/javase/10/docs/api/java/text/NumberFormat.html#hashCode() Comment More infoAdvertise with us Next Article SortedMap hashCode() method in Java with Examples G gopaldave Follow Improve Article Tags : Java Java-Functions Java-text package Java-NumberFormat Practice Tags : Java Similar Reads Short hashCode() method in Java with Examples The hashCode() method of Short class is a built in method in Java which is used to return the hash code of the ShortObject. Note: The hashCode() returns the same value as intValue(). Syntax ShortObject.hashCode() Return Value: It return an int value which represents the hashcode of the specified Sho 2 min read SortedMap hashCode() method in Java with Examples The hashCode() method of SortedMap interface in Java is used to generate a hashCode for the given map containing key and values. Syntax: int hashCode() Parameters: This method has no argument. Returns: This method returns the hashCode value for the given map. Note: The hashCode() method in SortedMap 2 min read Period hashCode() method in Java with Examples The hashCode() method of Period class in Java is used to get the generated hashCode for this period. Syntax: public int hashCode() Parameters: This method does not accepts any parameter. Return Value: This method returns the hashCode generated for the given period. Below programs illustrate the hash 2 min read Path hashCode() method in Java with Examples The Java Path interface was added to Java NIO in Java 7. hashCode() method of java.nio.file.Path used to return a hash code for this path after computing hashcode. The hashcode is always the same if the object doesnât change. Hashcode is a unique code generated by the JVM at time of object creation. 2 min read Properties hashCode() method in Java with Examples The hashCode() method of Properties class is used to generate a hashCode for the given Properties containing key and values. Syntax: public int hashCode() Parameters: This method has no argument. Returns: This method returns the hashCode value for the given map. Below programs show the implementatio 2 min read ValueRange hashCode() method in Java with Examples The hashCode() method of ValueRange class is used to get the hashCode value for this ValueRange. It returns an integer value which is the hashCode value for this instance of the ValueRange. Syntax: public int hashCode() Parameters: This method accepts nothing. Return value: This method returns a sui 1 min read Like