Home » Java programming language

Java Character.UnicodeBlock forName() method with example

Character.UnicodeBlock Class forName() method: Here, we are going to learn about the forName() method of Character.UnicodeBlock Class with its syntax and example.
Submitted by Preeti Jain, on December 13, 2019

Character.UnicodeBlock Class forName() method

  • forName() method is available in java.lang package.
  • forName() method is used to retrieve the name of Unicode block which is calculated by the Unicode Standards.
  • There are some rules to define the block name:
    • All spaces deleted by Unicode Standard by default.
    • Every constant UnicodeBlock identifier is text represented.
  • forName() method is a static method, it is accessible with the class name and if we try to access the method with the class object then we will not get any error.
  • forName() method is a final method it does not override in child class.
  • forName() method may throw an exception at the time of returning Unicode block,
    • IllegalArgumentException: This exception may throw when the given argument value is not valid.
    • NullPointerException: This exception may throw when the given argument value is null.

Syntax:

    public static final Character.UnicodeBlock forName(String bl_name);

Parameter(s):

  • String bl-name – represents the name of Unicode Block.

Return value:

The return type of this method is Character.UnicodeBlock, it returns the Unicode Block instance indicated by the given parameter bl_name(block name).

Example:

// Java program to demonstrate the example 
// of Character.UnicodeBlock forName(String bl_name)
// method of Character.UnicodeBlock class

public class ForName {
    public static void main(String args[]) {
        // By using forName() method is to return the UnicodeBlock instance
        // of the given block name
        Character.UnicodeBlock ub1 = Character.UnicodeBlock.forName("MYANMAR");
        Character.UnicodeBlock ub2 = Character.UnicodeBlock.forName("LIMBU");
        Character.UnicodeBlock ub3 = Character.UnicodeBlock.forName("MONGOLIAN");
        Character.UnicodeBlock ub4 = Character.UnicodeBlock.forName("OGHAM");
        Character.UnicodeBlock ub5 = Character.UnicodeBlock.forName("limbu");

        // Display UnicodeBlock instance
        System.out.println("ub1 = " + ub1);
        System.out.println("ub2 = " + ub2);
        System.out.println("ub3 = " + ub3);
        System.out.println("ub4 = " + ub4);
        System.out.println("ub5 = " + ub5);
    }
}

Output

ub1 = MYANMAR
ub2 = LIMBU
ub3 = MONGOLIAN
ub4 = OGHAM
ub5 = LIMBU





Comments and Discussions

Ad: Are you a blogger? Join our Blogging forum.





Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates


© https://www.includehelp.com some rights reserved.