Character.isIdentifierIgnorable() in Java

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

Approach 1: When the argument of type char.

Syntax:

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

This method takes one argument of type char as its parameter. This method determines if the specified character should be regarded as an ignorable character in a Java identifier or a Unicode identifier.

Parameters: One parameter is required for this method.

ch: the character to be tested.

Returns: true if the character is an ignorable control character that may be part of a Java or Unicode identifier; false otherwise.

Exceptions: NA

Java

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

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

Output:

false


Approach 2: When the argument of type int.

Syntax:

boolean java.lang.Character.isIdentifierIgnorable(int codePoint)

This method takes one argument of type int as its parameter. This method determines if the specified character (Unicode code point) should be regarded as an ignorable character in a Java identifier or a Unicode identifier.

Parameters: One parameter is required for this method.

codePoint: the character (Unicode code point) to be tested.

Returns: true if the character is an ignorable control character that may be part of a Java or Unicode identifier; false otherwise.

Exceptions: NA

Java

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

        int codePoint = 12;
        System.out.println(Character.isIdentifierIgnorable(codePoint));
    }
}

Output:

false

No comments:

Post a Comment