The values of the integral types are integers in the following ranges:
byte
, from -128 to 127, inclusive short
, from -32768 to 32767, inclusiveint
, from -2147483648 to 2147483647, inclusivelong
, from -9223372036854775808 to 9223372036854775807, inclusivechar
, from '\u0000'
to '\uffff'
inclusive, that is, from 0 to 65535A 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.