Java char data type


 

Java char data type

The char is a primitive data type. It is 16 bit type and used to represent Unicode characters. The range of char is 0 to 65,536. Below given a simple example of char data type.

The char is a primitive data type. It is 16 bit type and used to represent Unicode characters. The range of char is 0 to 65,536. Below given a simple example of char data type.

Code:

public class JavaChar {
  public static void main(String[] args) {
    char chr1 = 'e';
    char chr2 = 69;
    System.out.println("Value of char variable chr1 is :" + chr1);
    System.out.println("Value of char variable chr2 is :" + chr2);
  }
}

Output:

Download this code

Ads