0% found this document useful (0 votes)
10 views1 page

Bitwise vs Logical Operators in Java

Bitwise and logical operators process numerical and boolean data respectively. Bitwise operators work on individual bits and produce numeric results while logical operators work on booleans and produce boolean results. Bitwise operators always evaluate both operands but logical operators use short-circuit evaluation.

Uploaded by

dbawane7
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views1 page

Bitwise vs Logical Operators in Java

Bitwise and logical operators process numerical and boolean data respectively. Bitwise operators work on individual bits and produce numeric results while logical operators work on booleans and produce boolean results. Bitwise operators always evaluate both operands but logical operators use short-circuit evaluation.

Uploaded by

dbawane7
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Bitwise and Logic operator

In java, bitwise operator process numerical data and works on bit of those data. At a time one bit of that
data is processed. Logical operator works on boolean value.

Each one of operator type has binary as well as unary operator. Generally result of bitwise operator
would be some numeric value and logical operator produces Boolean result.

Difference between logical and bitwise operator

Both operator can be used on Boolean values. When bitwise operator used on Boolean values, it follows
rules of bitwise operator on Boolean values and result is produced.

Bitwise XOR (^) operator result

Another thing, bitwise operator evaluates both side operand before executing (example I, &). Other
hand logical operators are short circuit. If first operand result is enough to decide final result of logical
condition, it’ll never evaluate second operator.

You might also like