+ 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);

30th Nov 2020, 5:58 PM
Subhan Ahmed
Subhan Ahmed - avatar
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
30th Nov 2020, 6:01 PM
Charitra
Charitra - avatar