Could you please elaborate on that a little?
I mean, I thought that logical operators work on boolean expressions and return boolean values , whereas bitwise operators work on binary digits of integer values and return an integer.
In Java, when both operands are of type boolean
, the bitwise operators &
, |
and ^
are overloaded to act as logical operators too.
However in such case both sides are always eagerly evaluated.
While the logical operators &&
and ||
are short-circuit evaluated:
2 Likes