Sunday, May 3, 2020

Java UNICODE Characters

Java UNICODE Characters 



  • UNICODE stands for UNIversal CODE
  • Every character will have UNICODE value

 

Unicode Notation:


Syntax:

 

\uXXXX    - X will be hexadecimal digit

 

Starts with \u followed by four hexadecimal digits

 

UNICODE Range:

 

\u0000 (0) to \uFFFF (65535)

 

Example:

public class UnicodeExample {

 

     public static void main(String[] args) {

          char ch1 ='\u0061';

          char ch2='\u0062';

          System.out.println(ch1);

          System.out.println(ch2);

         

          char ch3 ='\u0041';

          char ch4='\u0042';

          System.out.println(ch3);

          System.out.println(ch4);

 

     }

 

}

 


Output:

 

a

b

A

B

No comments:

Post a Comment

If any suggestions or issue, please provide