Java Reference
In-Depth Information
Finally, a string literal might contain
Unicode escape sequences
, which are special
syntaxforrepresentingUnicodecharacters.AUnicodeescapesequencebeginswith
\u
andcontinueswithfourhexadecimaldigits(
0
-
9
,
A
-
F
,
a
-
f
)withnointerveningspace.
Forexample,
\u0041
representscapitalletterA,and
\u20ac
representstheEuropean
Union's euro currency symbol.
A
Boolean literal
consists of reserved word
true
or reserved word
false
.
A
character literal
consists of a single Unicode character surrounded by a pair of
singlequotes(
'A'
isanexample).Youcanalsorepresent,asacharacterliteral,anes-
cape sequence (
'\''
, for example) or a Unicode escape sequence (e.g.,
'\u0041'
).
An
integer literal
consistsofasequenceofdigits.Iftheliteralistorepresentalong
integer value, it must be suffixed with an uppercase
L
or lowercase
l
(
L
is easier to
read). If there is no suffix, the literal represents a 32-bit integer (an
int
).