The relational operators are syntactically left-associative (they group left-to-
right), but this fact is not useful; for example, a<b<c
parses as (a<b)<c
, which is
always a compile-time error, because the type of a<b
is always boolean
and <
is
not an operator on boolean
values.
RelationalExpression:
ShiftExpression
RelationalExpression<
ShiftExpression
RelationalExpression>
ShiftExpression
RelationalExpression<=
ShiftExpression
RelationalExpression>=
ShiftExpression
RelationalExpressioninstanceof
ReferenceType
The type of a relational expression is always boolean
.