A literal (§3.10) denotes a fixed, unchanging value.
The following production from §3.10 is repeated here for convenience:
Literal:
IntegerLiteral
FloatingPointLiteral
BooleanLiteral
CharacterLiteral
StringLiteral
NullLiteral
The type of a literal is determined as follows:
L
or l
is long
; the type of any other integer literal is int
.
F
or f
is float
; the type of any other floating-point literal is double
.
boolean
.
char
.
String
.
null
is the null type; its value is the null reference.
Evaluation of a literal always completes normally.