0% found this document useful (0 votes)
4 views1 page

Understanding X-OR and Bitwise Operators

Java scripts

Uploaded by

siva
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views1 page

Understanding X-OR and Bitwise Operators

Java scripts

Uploaded by

siva
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

X-OR Operator(^):This operator can be used for combining multiple conditions.

Syntax: (cond1) ^ (cond2) F F

The result of ^operator will be of boolean type [Link] result will F T T


be either true or false. The result will be true if the inputs are T
different and if the inputs are same the result will be false. T T F

Not operator(!): This operator can be used for complimenting the result of a condition i.e. it
converts true to false or false to true.
Syntax: ! (condition)
Rule: The logical operators can be applied to any combination of boolean type only.
The
6) Bitwise Operators: This operator will perform the operation on the bits of a number.
various bit wise operators are
Negation Operator()(tilde): This operator willconvert the bits from 0 to 1
and 1 to 05
0 0 0 1
X=5
1 1 1 1 1
X 1
of the negative number is
If the first bit is '1' then it representsa negative number. The value
calculated by performing 2's compliment.
2's compliment = 1's compliment + 1
1 1 1 1 1 0 1

0 0 1 0
1

1 1 0 -6

Note: ^X =X+1

Bitwise ANDOperator(&): This operator will perform AND operation on the bits of a
number.
0
X=5 0 0 1 1
1
y=6 0 0 1 1 0
1 1 0
1 1
X&y 0 0 0 1 0 0 : 4

You might also like