Java.lang.Character.UnicodeBlock.of(int codePoint) Method



Description

The java.lang.Character.UnicodeBlock.of(int codePoint) method returns the object representing the Unicode block containing the given character (Unicode code point), or null if the character is not a member of a defined block.

Declaration

Following is the declaration for java.lang.Character.UnicodeBlock.of() method

public static Character.UnicodeBlock of(int codePoint)

Parameters

codePoint − This is the character (Unicode code point).

Return Value

This method returns the UnicodeBlock instance representing the Unicode block of which this character is a member, or null if the character is not a member of any Unicode block.

Exception

IllegalArgumentException − if the specified codePoint is an invalid Unicode code point.

Example

The following example shows the usage of java.lang.Character.UnicodeBlock.of() method.

package com.tutorialspoint;

import java.lang.*;

public class CharacterUnicodeBlockDemo {

   public static void main(String[] args) {

      // returns the UnicodeBlock by specifying codePoint
      System.out.println(Character.UnicodeBlock.of(20));
      System.out.println(Character.UnicodeBlock.of(1009));    
      System.out.println(Character.UnicodeBlock.of(12345));        
      System.out.println(Character.UnicodeBlock.of(999));   
   }
} 

Let us compile and run the above program, this will produce the following result −

BASIC_LATIN
GREEK
CJK_SYMBOLS_AND_PUNCTUATION
GREEK
java_lang_character.unicodeblock.htm
Advertisements