char

The char keyword is used to declare a primitive Java data type containing a single 16-bit Unicode character in the range \u0000 to \uffff. Unicode characters are used to represent a majority of known written languages throughout the world. (ASCII characters make up a very small part of the Unicode character set.)

Note that values stored by char may be cast to and from other numeric types. However, because character data is implicitly unsigned, casts of char to byte or short can result in a negative number.

The following example demonstrates declaration and assignment for a char variable:

private char hitChar;

hitChar = 'a';