A literal denotes a fixed, unchanging value.
The following production 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.
==
and !=
If the operands of an equality operator are both of type boolean
, then the operation is boolean equality. The boolean
equality operators are associative.
The result of ==
is true
if the operands are both true
or both false
; otherwise, the result is false
.
The result of !=
is false
if the operands are both true
or both false
; otherwise, the result is true
. Thus !=
behaves the same as ^
when applied to boolean operands.