Java Data Type Tutorial - Java Character.getType(int codePoint)








Syntax

Character.getType(int codePoint) has the following syntax.

public static int getType(int codePoint)

Example

In the following code shows how to use Character.getType(int codePoint) method.

public class Main {
   public static void main(String[] args) {
      int cp1 = 0x0033, cp2 = 0x006e;
//from w  w w. jav  a  2 s.c o m
      int i1 = Character.getType(cp1);
      int i2 = Character.getType(cp2);

      // value 9 represents DECIMAL_DIGIT_NUMBER
      String str1 = "Category of cp1 is " + i1;
      //value 2 represents LOWERCASE_LETTER
      String str2 = "Category of cp2 is " + i2;

      // print i1, i2 values
      System.out.println( str1 );
      System.out.println( str2 );
   }
}

The code above generates the following result.