The hashCode() method of java.lang.Class class is used to get the hashCode representation of this entity. This method returns an integer value which is the hashCode.
public int hashCode()
Parameter: This method does not accept any parameter.
Return Value: This method returns an integer value which is the hashCode.
Below programs demonstrate the hashCode() method.
Class represented by c1: class java.lang.String HashCode value: 589431969
Class represented by c1: int HashCode value: 589431969
Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course.