Is there a difference between using a logical operator or a bitwise operator in an if block in Java?

前端 未结 5 2123
长发绾君心
长发绾君心 2020-12-24 10:28

The contents of both of the following if blocks should be executed:

if( booleanFunction() || otherBooleanFunction() ) {...}
if( booleanFunction() | otherBool         


        
5条回答
  •  鱼传尺愫
    2020-12-24 10:48

    Difference between bitwise a d logical operator- 1. Bitwise operator works on bit whereas logical operator works on statement. 2. Bitwise and is represented by & whereas logical and is represented by &&. 3. Bitwise or is represented by | whereas logical or is represented by ||.

提交回复
热议问题