EXPRESSIONS
Boolean Logical Operators
&
,
^
, and
|
15.21.2
15.21   Bitwise and Logical Operators
The
bitwise operators
 and
logical operators
 include the AND operator
&
, exclu 
sive OR operator
^
, and inclusive OR operator
|
. These operators have different
precedence, with
&
 having the highest precedence and
|
 the lowest precedence.
Each of these operators is syntactically left associative (each groups left to right).
Each operator is commutative if the operand expressions have no side effects.
Each operator is associative.
AndExpression:
EqualityExpression
AndExpression
 &
EqualityExpression
ExclusiveOrExpression:
AndExpression
ExclusiveOrExpression
 ^
AndExpression
InclusiveOrExpression:
ExclusiveOrExpression
InclusiveOrExpression
 |
ExclusiveOrExpression
The bitwise and logical operators may be used to compare two operands of
numeric type or two operands of type
boolean
. All other cases result in a com 
pile time error.
15.21.1   Integer Bitwise Operators
&
,
^
, and
|
When both operands of an operator
&
,
^
, or
|
 are of primitive integral type, binary
numeric promotion is first performed on the operands ( 5.6.2). The type of the bit 
wise operator expression is the promoted type of the operands.
For
&
, the result value is the bitwise AND of the operand values.
For
^
, the result value is the bitwise exclusive OR of the operand values.
For
|
, the result value is the bitwise inclusive OR of the operand values.
For example, the result of the expression
0xff00 & 0xf0f0
 is
0xf000
. The
result of
0xff00 ^ 0xf0f0
 is
0x0ff0
.The result of
0xff00 | 0xf0f0
 is
0xfff0
.
15.21.2   Boolean Logical Operators
&
,
^
, and
|
When both operands of a
&
,
^
, or
|
 operator are of type
boolean
, then the type of
the bitwise operator expression is
boolean
.
For
&
, the result value is
true
 if both operand values are
true
; otherwise, the
result is
false
.
365






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