Language syntax

Expression grouping and evaluation order

Parentheses change grouping; precedence and associativity determine grouping otherwise. Java evaluates ordinary binary operands left-to-right. Conditional and short-circuit expressions may skip operands. Avoid expressions with several mutations of the same variable.

Formal Syntax & Structure

java syntaxjava
(a + b) * c

Working Example

Example Snippetjava
public class Main {    public static void main(String[] args) {        System.out.println(12 - 4 - 3);        System.out.println(12 - (4 - 3));    }}
Java Reference