 |
The char primitive represents a 16 bit unsigned integral value. The Character object is a wrapper class for char.
All Java characters are in Unicode. If the nine most significant bits of a char are zero, the encoding is equivalent to seven bit ASCII.
Rules
- A char can range in value from 0 to 216-1.
- A char can be converted to an int, long, float or double without loss of information. This is known as a widening primitive conversion.
- A char can be converted to a short or byte but only with an explicit cast and loss of information may result. This is known as a narrowing primitive conversion.
- A char cannot be converted to a boolean.
|