CompositeName hashCode() method in Java with Examples Last Updated : 27 Mar, 2020 Summarize Comments Improve Suggest changes Share Like Article Like Report The hashCode() method of a javax.naming.CompositeName class is used to return the hash code of this composite name. The hash code of this composite name object is the sum of the hash codes of the "canonicalized" forms of individual components of this composite name. Syntax: public int hashCode() Parameters: This method accepts nothing. Return value: This method returns an int representing the hash code of this name. Below programs illustrate the CompositeName.hashCode() method: Program 1: Java // Java program to demonstrate // CompositeName.hashCode() import java.util.Properties; import javax.naming.CompositeName; import javax.naming.InvalidNameException; public class GFG { public static void main(String[] args) throws InvalidNameException { // create composite name object CompositeName CompositeName1 = new CompositeName("a/b/z/y/x"); // apply hashCode() int hashCode = CompositeName1.hashCode(); // print value System.out.println("hashCode:" + hashCode); } } Output: hashCode:558 Program 2: Java // Java program to demonstrate // CompositeName.hashCode() method import java.util.Properties; import javax.naming.CompositeName; import javax.naming.InvalidNameException; public class GFG { public static void main(String[] args) throws InvalidNameException { // create composite name object CompositeName CompositeName1 = new CompositeName("c/e/d/v/a/b/z/y/x/f/j"); // apply hashCode() int hashCode = CompositeName1.hashCode(); // print value System.out.println("hashCode:" + hashCode); } } Output: hashCode:1184 References: https://docs.oracle.com/javase/10/docs/api/javax/naming/CompositeName.html#hashCode() Comment More infoAdvertise with us Next Article Calendar hashCode() Method in Java with Examples A AmanSingh2210 Follow Improve Article Tags : Java Java-Functions Practice Tags : Java Similar Reads CompoundName hashCode() method in Java with Examples The hashCode() method of a javax.naming.CompoundName class is used to return the hash code of this compound name. The hash code of this compound name object is the sum of the hash codes of the "canonicalized" forms of individual components of this compound name. Syntax: public int hashCode() Paramet 2 min read Boolean hashCode() method in Java with examples The hashCode() method of Boolean class is a built in method to return a int hashcode value corresponding to the Boolean object. Syntax BooleanObject.hashCode() Return Type: It returns a int hashcode value corresponding to the Boolean object. It returns 1231 if the Boolean object stores the value tru 1 min read Boolean hashCode() method in Java with examples The hashCode() method of Boolean class is a built in method to return a int hashcode value corresponding to the Boolean object. Syntax BooleanObject.hashCode() Return Type: It returns a int hashcode value corresponding to the Boolean object. It returns 1231 if the Boolean object stores the value tru 1 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 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 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 Like