Java Boolean hashcode() MethodThe hashCode() method of Java Boolean class returns the hash code for Boolean. Overrides:The hashCode() method of Boolean class overrides the hashCode() method of class Object. Syntax:Parameters:NA value - is the Boolean value provided to hash. Return Value:This method returns a hash code value for this Boolean object.
Example 1Test it NowOutput: 1. Hash code of true = 1231 2. Hash code of false = 1237 Example 2Output: Enter your age 18 Hash code match i.e. 1231 You are an adult. You are eligible to vote. Example 3Output: Q How many days are there in a leap year? Ans: 366 Answer is right. Next TopicJava Boolean |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India