java2
java2
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