Boolean Operators

Most control flow expressions in Java direct program execution based on a computed true or false value. For instance, as you'll see later in this chapter, an if (expression) statement causes the next statement to be executed only if expression evaluates to true. You can actually write something like if (true), but this is not very useful in general (except for concepts such as conditional compilation, which you'll learn about later). Instead, control mechanisms such as the if statement are usually driven by a Boolean expression.

Note

The use of the term Boolean in this chapter refers to Boolean logic in general and not the Boolean class found in Java. The expressions used in flow control typically evaluate to the true and

Get Special Edition Using Java 2 Standard Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.