Lesson 8 | Determining order of evaluation |

Objective | Describe how operator precedence and associativity is used. |

The

`&&`

, `||`

, and ternary operators.Once an expression's operands are evaluated, the operators are applied according to operator precedence and associativity. The assignment operator is the only right-associative binary operator. Parentheses can be used to change the ordering imposed by precedence and associativity.

The following table shows the precedence of Java's operators. Higher-level operators take precedence over lower-level operators.

Operators at the same level are evaluated based on the order they appear and their associativity.

- Order of evaluation: The order in which expressions are evaluated.
- Precedence: The order in which operations are performed.

The following link contains a detailed description of Java operators and their precedence.

Java Operator Precedence

The Precedence program provides an example of how complex
expressions are evaluated.