Page 57 - CA_Blue( J )_Class9
P. 57
<60 C
Program 1 Write a program to display the ASCII code.
1 class ASCII
2 {
3 public static void main()
4 {
5 int i;
6 System.out.println("\tCharacter\t\tASCII VALUE");
7 for(i=0;i<=255;i++)
8 {
9 System.out.println("\t"+(char)i+"\t\t"+i);
10 }
11 }
12 }
4.2.2 Unicode
Unicode stands for Universal Character Encoding Standard, earlier known as “Universal Coded Character Set”. It
is another character encoding standard for different type of documents such as Text files, Web pages, etc.
Unicode represents the characters used in different languages around the world such as Hindi, English, French,
etc. Unicode uses different encoding forms, such as UTF-8, UTF-16, and UTF-32, to store characters efficiently
across various systems and applications.
Some advantages of Unicode character set are as follows:
• The acceptance of Unicode is universal as many operating systems, browsers and mobile devices support it.
• It is supported by various programming languages such as Java, XML, JavaScript, C++, etc.
• It defines characters in a 21-bit space, thus supporting more than 1 million characters. It is enough for every
human writing system.
• As it supports many characters, it allows the usage of local language.
• It also supports emoji characters.
The major disadvantage of Unicode characters is that some Unicode encodings require more memory as each
character requires more bits for its representation.
Program 2 Write a program to display the Unicode.
1 class Unicode
2 {
3 public static void main()
4 {
5 int i;
6 System.out.println("\tCharacter\t\tUnicode");
7 for(i=0;i<=65535;i++)
Values and Types 55

