Single Choice
Easy
QWhat is the result of the expression a |= 3 after it is executed in Java, where a is initially 5?
ID: #20169
Bitwise Operators
98 views
Question Info
#20169Q ID
EasyDifficulty
Bitwise OperatorsTopic
Your Answer
Choose the Best Option
Click any option to instantly check if you're correct.
Correct Answer
Explanation
The bitwise OR assignment operator (|=) in Java performs a bitwise OR operation between the variable on the left-hand side and the value on the right-hand side and assigns the result to the variable. In this case, a |= 3 is equivalent to 00000101 | 00000011, resulting in 00000111, which is 7 in decimal.
Continue Practice
Share
Share This Question
Challenge a friend or share with your study group.
More from This Topic