|
The Java Language
|
CS 161 - Java |
Type | Size | Values |
boolean | 1 bit | true or false |
char | 16 bit | Unicode characters |
boolean tOrF = true;
char c = 'a';
Java has special reserved words related to boolean types
true and
false are reserved words in Java
Used to save the result of a relation or conditional
operators (discussed later.)
A char variable (field) can hold a single
Unicode character
Any of over 34,000 distinct characters from the written languages of the
Americas, Europe, the Middle East, Africa, India, Asia, and Pacifica.
Java supports using a set of escape sequences to
represent frequently used special character values:
Escape sequence | Character value |
\b | Backspace |
\t | Tab character |
\n | Newline |
\r | Carriage return |
\" | Double quote |
\' | Single quote |
\\ | Backslash |
\uxxx | The Unicode character xxxx |