15.19
Relational Operators
EXPRESSIONS
right hand operand were subjected to a bitwise logical AND operator
&
 ( 15.21.1)
with the mask value
0x1f
. The shift distance actually used is therefore always in
the range 0 to 31, inclusive.
If the promoted type of the left hand operand is
long
, then only the six low 
est order bits of the right hand operand are used as the shift distance. It is as if the
right hand operand were subjected to a bitwise logical AND operator
&
 ( 15.21.1)
with the mask value
0x3f
. The shift distance actually used is therefore always in
the range 0 to 63, inclusive.
At run time, shift operations are performed on the two's complement integer
representation of the value of the left operand.
The value of
n<
 is
n
 left shifted
s
 bit positions; this is equivalent (even if
overflow occurs) to multiplication by two to the power
s
.
The value of
n>>s
 is
n
 right shifted
s
 bit positions with sign extension. The
resulting value is
s
n
2
. For nonnegative values of
n
, this is equivalent to trun 
cating integer division, as computed by the integer division operator
/
, by two to
the power
s
.
The value of
n>>>s
 is
n
 right shifted
s
 bit positions with zero extension. If
n
is positive, then the result is the same as that of
n>>s
; if
n
 is negative, the result is
equal to that of the expression
(n>>s)+(2<<~s)
 if the type of the left hand oper 
and is
int
, and to the result of the expression
(n>>s)+(2L<<~s)
 if the type of the
left hand operand is
long
. The added term
(2<<~s)
 or
(2L<<~s)
 cancels out the
propagated sign bit. (Note that, because of the implicit masking of the right hand
operand of a shift operator,
~s
 as a shift distance is equivalent to
31 s
 when shift 
ing an
int
 value and to
63 s
 when shifting a
long
 value.)
15.19   Relational Operators
The
relational operators
 are syntactically left associative (they group left to 
right), but this fact is not useful; for example,
a
 parses as
(a
, which is
always a compile time error, because the type of
a
 is always
boolean
 and
<
 is
not an operator on
boolean
 values.
RelationalExpression:
ShiftExpression
RelationalExpression
 <
ShiftExpression
RelationalExpression
 >
ShiftExpression
RelationalExpression
 <=
ShiftExpression
RelationalExpression
 >=
ShiftExpression
RelationalExpression
 instanceof
ReferenceType
The type of a relational expression is always
boolean
.
360






footer




 

 

 

 

 Home | About Us | Network | Services | Support | FAQ | Control Panel | Order Online | Sitemap | Contact

java hosting

 

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