Byte.hashCode() in Java

Byte.hashCode(): This method is available in the java.lang.Byte class of Java.

Syntax:

int java.lang.Byte.hashCode(byte value)

This method takes one argument of type byte as its parameter. This method returns a hash code for a byte value.

Parameters: One parameter is required for this method.

value: the value to the hash.

Returns: a hash code value for a byte value.

For Example:

Byte.hashCode(123) = > It returns 123.

Approach

Java

public class BytehashCode {
    public static void main(String[] args) {

        byte value = 123;
        System.out.println(Byte.hashCode(value));

    }
}

Output:

123

No comments:

Post a Comment