Logical and Bitwise Not Operators on Boolean
Output
0 1 1 0
The outputs of above programs are as expected, but the outputs following programs may not be as expected if we have not used Bitwise Not (or ~) operator before.
- Python
- Java
# A Python program that uses Logical Not or ! on booleana = not Trueb = not Falseprint aprint b# Output: False# True |
0 1 1 0
The outputs of above programs are as expected, but the outputs following programs may not be as expected if we have not used Bitwise Not (or ~) operator before.
# A Python program that uses Bitwise Not or ~ on booleana = Trueb = Falseprint ~aprint ~b |