Java boolean |= operator


Recently I saw a code using this:

boolean val = something();
val |= somethingElse();
Interesting part is |= (binary like) operator made on boolean primitive type.

It surprised me that |= exist for boolean, as if it was integer type, and searched Java specification for this operator, but could not find any.

I'd be curious if right operand is evaluated if left value already is true.

Can someone point me to Java specification of this?

Source: http://apple.stackexchange.com/



No comments:

Post a Comment