EXPRESSIONS
Type Comparison Operator
instanceof
15.19.2
15.19.1 Numerical Comparison Operators
<
,
<=
,
>
, and
>=
The type of each of the operands of a numerical comparison operator must be a
primitive numeric type, or a compile time error occurs. Binary numeric promotion
is performed on the operands ( 5.6.2). If the promoted type of the operands is
int
or
long
, then signed integer comparison is performed; if this promoted type is
float
or
double
, then floating point comparison is performed.
The result of a floating point comparison, as determined by the specification
of the IEEE 754 standard, is:
If either operand is NaN, then the result is
false
.
All values other than NaN are ordered, with negative infinity less than all
finite values, and positive infinity greater than all finite values.
Positive zero and negative zero are considered equal. Therefore,
0.0<0.0
is
false
, for example, but
0.0<=0.0
is
true
. (Note, however, that the meth
ods
Math.min
( 20.11.27, 20.11.28) and
Math.max
( 20.11.31, 20.11.32)
treat negative zero as being strictly smaller than positive zero.)
Subject to these considerations for floating point numbers, the following rules
then hold for integer operands or for floating point operands other than NaN:
The value produced by the
<
operator is
true
if the value of the left hand
operand is less than the value of the right hand operand, and otherwise is
false
.
The value produced by the
<=
operator is
true
if the value of the left hand
operand is less than or equal to the value of the right hand operand, and other
wise is
false
.
The value produced by the
>
operator is
true
if the value of the left hand
operand is greater than the value of the right hand operand, and otherwise is
false
.
The value produced by the
>=
operator is
true
if the value of the left hand
operand is greater than or equal to the value of the right hand operand, and
otherwise is
false
.
15.19.2 Type Comparison Operator
instanceof
The type of a
RelationalExpression
operand of the
instanceof
operator must be
a reference type or the null type; otherwise, a compile time error occurs. The
Ref
erenceType
mentioned after the
instanceof
operator must denote a reference
type; otherwise, a compile time error occurs.
361
footer
Our partners:
PHP: Hypertext Preprocessor Best Web Hosting
Java Web Hosting
Inexpensive Web Hosting
Jsp Web Hosting
Cheapest Web Hosting
Jsp Hosting
Cheap Hosting
Visionwebhosting.net Business web hosting division of Web
Design Plus. All rights reserved