+ 2
Anyone can explain.what these two statements are doing in java?
Anyone can explain.what these two statements are doing int z=x&y; int w=z|(y^255);
1 Answer
+ 6
& is 'bitwise and' operator. It compares two numbers bit by bit and performs AND Operation.
3&4 is 0011&0100... each bit is compared with other bit.
| is 'bitwise or' operator. It works same as & but it performs OR operation.
[edit]
^ is "bitwise XOR" opetator. it performs XOR operation.
[edit2]
you can also refer theseđ
https://www.sololearn.com/learn/4072/?ref=app
https://www.sololearn.com/learn/4073/?ref=app
https://www.sololearn.com/learn/4074/?ref=app