Java Reference
In-Depth Information
You can output a char value using a println( ) statement. For example, this line outputs
the value in ch :
Since char is an unsigned 16-bit type, it is possible to perform various arithmetic ma-
nipulations on a char variable. For example, consider the following program:
The output generated by this program is shown here:
In the program, ch is first given the value X. Next, ch is incremented. This results in ch
containing Y, the next character in the ASCII (and Unicode) sequence. Next, ch is assigned
the value 90, which is the ASCII (and Unicode) value that corresponds to the letter Z. Since
the ASCII character set occupies the first 127 values in the Unicode character set, all the
“old tricks” that you may have used with characters in other languages will work in Java,
too.
Search WWH ::




Custom Search