Java-Unicode to Represent Characters

Unicode to Represent Characters

Character have numeric values. For example, the character ‘C’ is actually encoded as 67. Because, Java uses Unicode to represent characters. Unicode defines a fully international character set that can represent all of the characters found in all human languages. It is a unification of dozens of character sets, such as Latin, Greek, Arabic, Cyrillic, Hebrew, Katakana , Hangul, and many more. For this purpose , it requires 16 bits. Thus, in Java char is a 16-bit type. The range of a char is 0 to 65,536. There are no negative chars. The standard set of characters known as ASCII still ranges from 0 to 127 as always, and the extended 8-bit character set, ISO-latin-1, ranges from 0 to 255.



Program Source

class Javaapp {

    public static void main(String[] args) {
        char ch1 = 67;
        char ch2 = 104;
        System.out.println("ch1 = "+ch1);
        System.out.println("ch2 = "+ch2);

Leave a Comment