"Assume integer variable A holds 60 and variable B holds 13 then:
A&B will give 12"
Why is this?
"Assume integer variable A holds 60 and variable B holds 13 then:
A&B will give 12"
Why is this?
In C, Java and other languages, & is the bitwise and of the integer operands. So for example, 6 & 4 is 110 & 100 = 100 = 4. Similarly | is the bitwise or operator. So 6 | 4 = 110 | 100 = 110 = 6. Similarly ^ is the bitwise exclusive or operator. So 6 ^ 4 = 010 = 2.
![]() |