char Datatype example in Java

char:
char is 16 bit type and used to represent Unicode characters.
Range of char is 0 to 65,536.

Syntax:
Declare char varibale as below
char <variable name> = <default value>;

Note:
here assigning default value is optional.

class Char
{
public static void main(String a[])
{

                char ch1 = 'b';
                char ch2 = 66; /* ASCII code of 'A'*/
               
                System.out.println("Value of char variable ch1 is :" + ch1);   
                System.out.println("Value of char variable ch2 is :" + ch2);    
}
}        


Output:
Value of char variable ch1 is :b
Value of char variable ch1 is :B