-
The java.lang.Character.isIdentifierIgnorable(char ch) is an inbuilt method in java that determines if the specified character should be regarded as an ignorable character in a Java identifier or a Unicode identifier.
The following Unicode characters are ignorable in a Java identifier or a Unicode identifier:
- ISO control characters that are not whitespace
- ‘\u0000’ through ‘\u0008’
- ‘\u000E’ through ‘\u001B’
- ‘\u007F’ through ‘\u009F’
- all characters that have the FORMAT general category value
Syntax:
public static boolean isIdentifierIgnorable(char ch)
Parameters: The parameter ch is of character datatype and refers to the character that is to be tested.
Return Value: This method returns true if the character is an ignorable control character that may be part of a Java or Unicode identifier, false otherwise.
Below programs illustrate the Character.isIdentifierIgnorable(char ch) method:
Program 1:
// Java program to illustrate// Character.isIdentifierIgnorable(char ch) methodimportjava.lang.*;publicclassgfg {publicstaticvoidmain(String[] args) {// Creates 2 character primitives c1, c2 and assigning valuescharc1='\u0000', c2='9';// Assigns isIdentifierIgnorable results of// c1, c2 to boolean primitivesbooleanbool1 = Character.isIdentifierIgnorable(c1);booleanbool2 = Character.isIdentifierIgnorable(c2);String str1 ="c1 is an ignorable control character is "+ bool1;String str2 ="c2 is an ignorable control character is "+ bool2;System.out.println( str1 );System.out.println( str2 );}}chevron_rightfilter_noneOutput:c1 is an ignorable control character is true c2 is an ignorable control character is false
Program 2:
importjava.lang.*;publicclassgfg {publicstaticvoidmain(String[] args) {// Create 2 character primitives c1, c2 and assigning valuescharc1='\u000E', c2='8';// Assigns isIdentifierIgnorable results of// c1, c2 to boolean primitivesbooleanbool1 = Character.isIdentifierIgnorable(c1);booleanbool2 = Character.isIdentifierIgnorable(c2);String str1 ="c1 is an ignorable control character is "+ bool1;String str2 ="c2 is an ignorable control character is "+ bool2;System.out.println( str1 );System.out.println( str2 );}}chevron_rightfilter_noneOutput:c1 is an ignorable control character is true c2 is an ignorable control character is false
- ISO control characters that are not whitespace
- The java.lang.Character.isIdentifierIgnorable(int codePoint) is similar to the previous method in all manner.
Syntax:
public static boolean isIdentifierIgnorable(int codePoint)
Parameter: The function accepts a single parameter codePoint of integer datatype which specifies the character (Unicode code point) that is to be tested.
Return value: This method returns true if the character is an ignorable control character that may be part of a Java or Unicode identifier, false otherwise.
Below program illustrates the Character.isIdentifierIgnorable(int codepoint) method:
Program 1:// Java program to demonstrate// the Character.isIdentifierIgnorable(int codepoint) methodimportjava.lang.*;publicclassgfg {publicstaticvoidmain(String[] args) {// Integer primitives c1, c2intc1 =0x019f, c2 =0x1abc;// Assign isIdentifierIgnorable results of cp1, cp2// to boolean primitives bool1, bool2booleanbool1 = Character.isIdentifierIgnorable(c1);booleanbool2 = Character.isIdentifierIgnorable(c2);// Print bool1, bool2 valuesSystem.out.println("c1 is an ignorable control character?"+" ans is "+bool1);System.out.println("c2 is an ignorable control character?"+" ans is "+bool2);}}chevron_rightfilter_noneOutput:c1 is an ignorable control character? ans is false c2 is an ignorable control character? ans is false
Program 2:
// Java program to demonstrate// the Character.isIdentifierIgnorable(int codepoint) methodimportjava.lang.*;publicclassgfg {publicstaticvoidmain(String[] args) {// Integer primitives c1, c2intc1 =0x119f, c2 =0x0abc;// Assign isIdentifierIgnorable results of cp1, cp2// to boolean primitives bool1, bool2booleanbool1 = Character.isIdentifierIgnorable(c1);booleanbool2 = Character.isIdentifierIgnorable(c2);// Print bool1, bool2 valuesSystem.out.println("c1 is an ignorable control character?"+" ans is "+bool1);System.out.println("c2 is an ignorable control character?"+" ans is "+bool2);}}chevron_rightfilter_noneOutput:c1 is an ignorable control character? ans is false c2 is an ignorable control character? ans is false
Reference: https://docs.oracle.com/javase/7/docs/api/java/lang/Character.html#isIdentifierIgnorable(char)
Attention reader! Don’t stop learning now. Get hold of all the important Java and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready.
Recommended Posts:
- Java.util.BitSet class methods in Java with Examples | Set 2
- Java.util.BitSet class in Java with Examples | Set 1
- Java.util.Collections.rotate() Method in Java with Examples
- Java.util.Collections.frequency() in Java with Examples
- Java.util.Arrays.equals() in Java with Examples
- Java.util.Collections.disjoint() Method in java with Examples
- Java 8 | Consumer Interface in Java with Examples
- Java.util.LinkedList.poll(), pollFirst(), pollLast() with examples in Java
- Java 8 | ArrayDeque removeIf() method in Java with Examples
- Java lang.Long.lowestOneBit() method in Java with Examples
- Java lang.Long.numberOfTrailingZeros() method in Java with Examples
- Java lang.Long.numberOfLeadingZeros() method in Java with Examples
- Java lang.Long.highestOneBit() method in Java with Examples
- Java lang.Long.byteValue() method in Java with Examples
- Java lang.Long.reverse() method in Java with Examples
- Java lang.Long.builtcount() method in Java with Examples
- Java Clock tickMinutes() method in Java with Examples
- Java Clock withZone() method in Java with Examples
- Java.util.concurrent.RecursiveAction class in Java with Examples
- Java 8 | BiConsumer Interface in Java with Examples
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

