Tuesday, December 30, 2008

What are Character Data Types in Java

Welcome back to Java Code Online. 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 then 8 bit of data. That makes Java a truly international language, since by using Unicode charset, 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.

Now the Character Data types in Java must be clear to you. In case you liked my article or if if you have any doubt, then do leave a comment. For more info on Java, keep buzzing Java Code Online.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.