Tuesday, May 27, 2008

Characters

The keyword char denotes the character data type. The char type is exactly like char in C/C++ with only the one major difference. The char type in Java stores its values using the 16 bit Unicode format.

The following is an example of a char. Notice that there are single quotation marks around the actual character. Then denotes that X is a character literal, which was described earlier.

char mychar = 'X';

No comments: