Charset hashCode() in Java

hashCode(): This method is available in java.nio.charset.Charset class of Java.

Syntax:

int java.nio.charset.Charset.hashCode()

This method computes a hashcode for this charset.

Parameters: NA

Returns: An integer hashcode.

Approach

Java

import java.nio.charset.Charset;

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

        Charset cs = Charset.forName("UTF-8");
        System.out.println(cs.hashCode());
    }
}

Output:

81070450

No comments:

Post a Comment