Java Boolean hashcode() MethodLast Updated : 17 Mar 2025 The 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 1Compile and RunOutput: 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 request you to subscribe our newsletter for upcoming updates.

We deliver comprehensive tutorials, interview question-answers, MCQs, study materials on leading programming languages and web technologies like Data Science, MEAN/MERN full stack development, Python, Java, C++, C, HTML, React, Angular, PHP and much more to support your learning and career growth.
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India