O'Reilly logo

Java Enterprise in a Nutshell, Third Edition by William Crawford, Jim Farley

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Operators

Operators are used to compose identifiers and literals into larger expressions. Operators can be logical operators , arithmetic operators, or comparison operators.

Logical Operators

The logical operators are NOT, AND, and OR. These are in precedence order. These have the usual Boolean logic semantics. If a logical operator is applied to header fields or properties whose value is NULL, then the following rules apply:

  • ANDing a NULL value with a FALSE value evaluates to FALSE; ANDing a NULL with a TRUE or NULL value evaluates to a NULL (or unknown) value.

  • ORing a NULL value with a TRUE value evaluates to TRUE; ORing a NULL with a FALSE or a NULL value evaluates to a NULL (or unknown) value.

  • Applying NOT to a NULL value evaluates to a NULL (or unknown) value.

Arithmetic Operators

The arithmetic operators, in precedence order, are + and - (unary); * and /; and + and - (binary). These have the usual arithmetic semantics. Any arithmetic operator that is applied to one or more NULL values evaluates to a NULL value.

Comparison Operators

The comparison operators can be loosely grouped into equality comparisons and range comparisons. The basic equality comparison operators, in precedence order, are =, >, >=, <, <=, and <>. These binary operators have to be applied to two values of the same type, else the expression will always evaluate to FALSE. If either value is NULL, then the result of the comparison is NULL. There are also the equality operators IS NULL and IS NOT NULL to compare ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required