Character Data Types in Java

Character Data Types in Java

The data types in Java can be categorized in four categories. Character Data Types is the third category after Integer Data Types and Floating Point Data Types.

In Java the Character Data type is of single type. It is:-
1. char (16 bits) (range: 0 to 65535)

We will discuss this data type of Java in detail now.

char
"char data type in Java" has some special features which were not present in its predecessors like C and C++. In Java the "char" Data Type is 16 bit long. Java uses Unicode to represent characters, and so for languages which have long Unicode representations do have characters which require more than 8 bit of data. That makes Java a truly international language, since by using Unicode char set, Java can define any language in the world.

If you have noticed above, then you would have seen that the range of "char" data type is from 0 to 65535, there are no negative chars. The range that the "char" data type enjoy in Java, is truly awesome, and makes Java one of the most global languages in the world.

Regarding functionality of the "char" data type. A "char" data type in Java is capable of handling one character at a time. For example:-

char testing = 'j';

Here the variable testing is of "char" Data Type, and is assigned equal to the character 'j'. So isn't it simple.