Subscribe

RSS Feed (xml)

Powered By

Skin Design:
Free Blogger Skins

Powered by Blogger

Monday, November 19, 2007

java Logical Operators

The operands must be boolean. The result is boolean.
b && cConditional "and". true if both operands are true, otherwise false. Short circuit evaluation. Eg (false && anything) is false.
b || c Conditional "or". true if either operand is true, otherwise false. Short circuit evaluation. Eg (true || anything) is true.
!b true if b is false, false if b is true.
b & c"And" which always evaluate both operands (not short circuit).
b | c"Or" which always evaluate both operands (not short circuit).
b ^ c"Xor" Same as b != c

No comments:

Post a Comment

Archives