Click here to navigate the course.

Drag the edges to resize the window.

In Projects, you can keep track of your progress as you go throught the tasks. Check each item as you complete it!

Code Editor
Learn

The three Boolean operators &&, ||, and ! can also be used together and used multiple times to form larger Boolean expressions.

However, just like numerical operators, Boolean operators follow rules that specify the order in which they are evaluated. This order is called Boolean operator precedence.

The precedence of each Boolean operator is as follows:

  1. ! is evaluated first
  2. && is evaluated second
  3. || is evaluated third

Like numerical expressions, every expression within parentheses is evaluated first. Expressions are also read from left to right.

The following statement demonstrates how Boolean operator precedence works:

System.out.println( !(false) || true && false);

The example above will print out true. In order, the expression is evaluated as follows:

  1. First, the ! Boolean operator in !(false) returns true.
  2. Second, true && false evaluates to false.
  3. Finally, the remaining expression true || false evaluates to true.
Report a Bug
If you see a bug or any other issue with this page, please report it here.