Boolean tab Syntax Buttons

The Boolean tab syntax buttons indicate all the ways you can add or use a Boolean in an expression. Clicking on one of the buttons adds the indicated syntax (minus the question marks) to your expression. In the spaces left by the question marks, enter the appropriate values.

The semantics of Boolean operations exactly mimic those of Java’s Boolean operators, as defined in The Java Language Specification. See the following for a summary descriptive list of all the operators you can use in the Java language:

http://java.sun.com/docs/books/tutorial/java/nutsandbolts/opsummary.html

Boolean Syntax Button Descriptions

Syntax Button

Operator

Operator Type

Description

true

literal

Boolean

The Boolean literal corresponding to the primitive value true. See also Boolean Literals.

false

literal

Boolean

The Boolean literal corresponding to the primitive value false. See also Boolean Literals.

!?

boolean NOT

logical

Returns true if the operand is false.

? && ?

boolean AND

Compares both operands. Returns true if both operand 1 and operand 2 are true.

? || ?

boolean OR

Compares both operands. Returns true if either operand 1 or operand 2 is true.

? & ?

bitwise AND

bitwise logical

Compares both operands. Returns true if operand 1 and operand 2 are both boolean and both true; always evaluates operand 1 and operand 2.

? ^ ?

bitwise exclusive OR

Compares both operands. Returns true if operand 1 and operand 2 are different — that is, if one or the other of the operands, but not both, is true.

? | ?

bitwise inclusive OR

Compares both operands. Returns true if both operand 1 and operand 2 are boolean and either operand 1 or operand 2 is true; always evaluates operand 1 and operand 2.

~ ?

bitwise complement

Inverts the value of each operand bit: If the operand bit is 1 (true), the resulting bit is 0 (false); if the operand bit is 0 (false), the resulting bit is 1 (true).

? == ?

equal to

conditional equality (For Java objects, equality is determined by invoking the equals() method on the first operand with the second operand as argument.)

Returns true if operand 1 and operand 2 are equal.

? != ?

not equal to

Returns true if operand 1 and operand 2 are not equal.

? < ?

less than

conditional relation

Returns true if operand 1 is less than operand 2.

? > ?

greater than

Returns true if operand 1 is greater than operand 2.

? <= ?

less than or equal to

Returns true if operand 1 is less than or equal to operand 2.

? >= ?

greater than or equal to

Returns true if operand 1 is greater than or equal to operand 2.

? instanceof ?

instance of

conditional instance

Returns true if operand 1 is an instance of the class represented by operand 2.

(?) ? (?): (?)

if then else

conditional true and else

If operand 1 is true, returns operand 2. Otherwise, returns operand 3.

? &&= ?

logical AND

relational and assignment (The operand on the left of the assignment statement (the first operand) can be any type of variable, including an array component or a public class attribute.)

Returns true if operand 1 and operand 2 are both true and assigns operand 2 to operand 1; conditionally evaluates operand 2.

? ||= ?

logical OR and assign

Returns true if either operand 1 or operand 2 is true and then assigns operand 2 to operand 1; conditionally evaluates operand 2.

? &= ?

AND and assign

First, compares both operands. If both operand bits are true, the AND function sets the resulting bit to true (1); otherwise, the resulting bit is set to false (0).

Then, assigns the resulting bit to operand 1.

? ^= ?

XOR and assign

First, compares both operands. If both operand bits are different, the resulting bit is true (1); otherwise the resulting bit is false (0).

Then, assigns the resulting bit to operand 1.

? |= ?

OR and assign

First, compares both operands. If either of the two operand bits is true (1), the resulting bit is true (1). Otherwise, the resulting bit is false (0).

Then, assigns the resulting bit to operand 1.

Note
  • For Java objects which are instances of the java.lang.Comparable interface, comparison is determined by invoking the compareTo() method on the first operand with the second operand as argument for operator types "less than" and "greater than" operators.

  • For Java objects which are not instances of the java.lang.Comparable interface, comparison can only verify equality as with the == or != operators by invoking the equals() method on the first operand with the second operand as argument for operator types "less than or equal to and "greater than or equal to" operators. The operator returns true only if equals() returns true. As such, only equality is being verified and not greater or less.