| Java FAQ | ||
| JSP FAQ | ||
| Servlet FAQ | ||
XyzWs Java FAQ:
What is valid value range for char?
Printer-friendly version |
Mail this to a friend
|
Advertisement
|
||||||||||||
What is valid value range for char?A char supports a 16-bit unicode character and is unsigned 2 byte integer. It can be assigned directly to an integer value but the integer value must be in its value range or you would get a compiler error. The largest number it can hold is 216 which is 65535. The following value ranges are equivalent to represent the value range of char:
Any numeric assignment to a char could be cast to a char and get past the compiler in this case the char will only contain the right two bytes. |