Character.isSurrogate() in Java

Character.isSurrogate(): This method is available in java.lang.Character class of Java.

Syntax:

boolean java.lang.Character.isSurrogate(char ch)

This method takes one argument of type char as its parameter. This method determines if the given char value is a Unicode surrogate code unit.

Note: A char value is a surrogate code unit if and only if it is either a low-surrogate code unit or a high-surrogate code unit.

Parameters: One parameter is required for this method.

ch: the char value to be tested.

Returns: true if the char value is between MIN_SURROGATE and MAX_SURROGATE inclusive; false otherwise.

Exceptions: NA

Approach

Java

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

        char ch = 'a';
        System.out.println(Character.isSurrogate(ch));
    }
}

Output:

false

No comments:

Post a Comment