Java Reference
In-Depth Information
A compile-time error does not occur if a non-zero floating-point literal has a small value
that, on rounded conversion to its internal representation, becomes a non-zero denormal-
ized number.
Predefined constants representing Not-a-Number values are defined in the classes Float and
Double as Float.NaN and Double.NaN .
Examples of float literals:
1e1f 2.f .3f 0f 3.14f 6.022137e+23f
Examples of double literals:
1e1 2. .3 0.0 3.14 1e-9d 1e137
3.10.3. Boolean Literals
The boolean type has two values, represented by the boolean literals true and false , formed
from ASCII letters.
BooleanLiteral: one of
true false
A boolean literal is always of type boolean 4.2.5 ) .
3.10.4. Character Literals
A character literal is expressed as a character or an escape sequence (§ 3.10.6 ) , enclosed in
ASCII single quotes. (The single-quote, or apostrophe, character is \u0027 .)
CharacterLiteral:
' SingleCharacter '
' EscapeSequence '
SingleCharacter:
InputCharacter but not ' or \
See § 3.10.6 for the definition of EscapeSequence .
Character literals can only represent UTF-16 code units (§ 3.1 ) , i.e., they are limited to val-
ues from \u0000 to \uffff . Supplementary characters must be represented either as a surrogate
pair within a char sequence, or as an integer, depending on the API they are used with.
A character literal is always of type char 4.2.1 ).
Search WWH ::




Custom Search