Character Data Types

  • The character data type is stored characters such as b,q,k,t,*, etc.
  • This data type is represented by the key ward char.
  • Char in Java is not the same as the char in c or c++ that means there is a difference.
  • The difference is in C/C++ char is an integer type i.e. 8 bits(1byte)
  • But java this is different. Java uses Unicode to represent a character.
  • Unicode defines a fully international character set that represents all character found in all human language.
  • It is a unification dozen character sets such as Latin, Greek, Arabic and many more.
  • For this purpose, java character requires 2 bytes (16bits).
  • The range of character is 0 to 65, 536. This means a total of 65536 distinct characters can be recognized by Java.
  • In the Unicode system, the lowest value is \u0000 and the highest value is \uFFFF.
  • Let us see a program to understand the char variables.
class Test
    public static void main (String args[ ])
        char c1, c2;
        c2 =?A?;
        System.out.println (c1+c2);



Let's see another program on the character data type.

class CharacterDemo
    public static void main (String args[ ])
        char c1;
        c1 =?A?;
        System.out.println (?c1 is ?+c1);



Our Services:

Java Training | Python Training | Machine Learning with Python Training | Deep Learning with Python Training | Data Science with Python Training | Projects

SILAN Technology, BBSR
Call to: 0674-2361252