Boolean.hashCode(): This method is available in the java.lang.Boolean class of Java.
Syntax:
int java.lang.Boolean.hashCode(boolean value)
This method takes one argument of type boolean as its parameter. This method returns a hash code for a boolean value.
Parameters: One parameter is required for this method.
value: the value to the hash.
Returns: a hash code value for a boolean value.
For Example:
Boolean.hashCode(true) = > It returns 1231.
Approach
Java
public class BooleanhashCode {public static void main(String[] args) {boolean value = true;System.out.println(Boolean.hashCode(value));}}
Output:
1231
No comments:
Post a Comment