Boolean operators



Boolean operators help to build more complex expressions by combining two or more conditional expressions into a larger one.
Each of the operands of such an expression must evaluate to a boolean value:

Conditional AND (&&)

This operator combines two expressions that evaluates to true, and if both are true – the whole expression evaluates to true. For example:

Conditional OR (||)

This operator combines two expressions and at least one of them have to evaluate to true, in that case – the whole expression evaluates to true. For example:

Boolean NOT (!)

This operator changes the boolean value that an expression is evaluated to.
If the expression evaluates to true, then the operator changes it to false and vice versa.

For example:

It’s the same thing as writing:







Search for more Java info on this site here:
Custom Search


Please type any questions here.