The hashCode() method of Boolean class returns the hash code for the specified Boolean object or the given Boolean value.

Syntax

  1. public int hashCode()
  2. public int hashCode(boolean value)

Parameters

The parameter ‘value’ represents the value to hash.

 Overrides

The hashCode() method overrides hashcode in class object.

 Return Value:

The hashCode () method returns a hash code value based on Boolean’s value.

  • It returns 1231, if the Boolean’s value is true.
  • It returns 1237, if the Boolean’s value is false.

Example 1

Output

Example 2

Output

Example 3

Output

Example 4

Output

Pin It on Pinterest

Share This