Java Reference
In-Depth Information
Table 4-5. ( continued )
Operator
Name
Syntax
Description
!==
Non-identity
or strict
inequality
op1 !== op2
Returns true if the operands are not
equal and/or not of the same type. Both
expressions "2" !== 2 and 2 !==3
return true . In the first expression, types
of operands do not match (string and
number) and, in the second one, the
values of the operands do not match.
<<
Bitwise left
shift
op1 << op2
Performs a bitwise left shift operation
on op1 by the amount specified by op2 .
Before performing the left shift, op1 is
converted to a 32-bit signed integer. The
result is also a 32-bit signed integer.
>>
Bitwise signed
right shift
op1 >> op2
Performs a sign-filling bitwise right shift
operation on op1 by the amount specified
by op2 . The new bits on the left are filled
with the original most significant bit that
keeps the sign of the op1 and the result
the same. Converts op1 to a 32-bit signed
integer and the result is also a 32-bit
signed integer.
>>>
Bitwise
unsigned right
shift
op1 >>> op2
Performs a zero-filling bitwise right shift
operation on op1 by the amount specified
by op2 . The new bits on the left are filled
with zeros that makes the result an
unsigned 32-bit integer.
&
Bitwise AND
op1 & op2
Performs a bitwise AND operation on
each pair of bits of op1 and op2 . If both
bits are 1, the resulting bit is 1. Otherwise,
the resulting bit is 0.
|
Bitwise OR
op1 | op2
Performs a bitwise OR operation on each
pair of bits of op1 and op2 . If either bit is
1, the resulting bit is 1. If both bits are 0,
the resulting bit is 0.
^
Bitwise XOR
op1 ^ op2
Performs a bitwise XOR operation on
each pair of bits of op1 and op2 . If bits are
different, the resulting bit is 1. Otherwise,
the resulting bit is 0.
&&
op1 && op2
Returns op1 or op2 . If op1 is false or can
be converted to false , op1 is returned.
Otherwise, op2 is returned.
Logical AND
( continued )
Search WWH ::




Custom Search