Charset isRegistered() in Java

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

Syntax:

boolean java.nio.charset.Charset.isRegistered()

This method tells whether or not this charset is registered in the IANA Charset Registry.

Parameters: NA

Returns: true if, and only if, this charset is known by its implementor to be registered with the IANA.

For Example:

Charset cs = Charset.forName("UTF-8")

cs.isRegistered() = > It returns true.

Approach

Java

import java.nio.charset.Charset;

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

        Charset cs = Charset.forName("UTF-8");

        System.out.println(cs.isRegistered());
    }
}

Output:

true

No comments:

Post a Comment