Conditional and logical operators and expressions

The conditional operators are shown in Table 1.
Table 1. Conditional operators
Operator Operation
== Equal
!= Not equal
> Greater than
< Less than
>= Greater than or equal
<= Less than or equal
The logical operators are shown in Table 2.
Table 2. Logical operators
Operator Operation
&& AND
|| OR
If you are entering && in an HTML or XML editor you might have to enter &amp;&amp;
In a conditional expression the terms are evaluated left to right. The order of precedence of the operators is the same order in which they are listed in the tables above. You can use parentheses to indicate the order in which you want expressions to be evaluated. Examples:
Expression:                  Evaluates to:

(4 > 3)                      true
!(4 > 3 )                    false
(4 > 3) && (8 > 10)          false
(4 > 3) || (8 > 10)          true

A conditional expression can contain arithmetic expressions, variables, and calls to methods of imported Java™ classes.

Conditional and logical operators can be used in only two contexts:
  • The Condition field of a conditional descriptor
  • The Condition field of a conditional action