🌐
Princeton CS
introcs.cs.princeton.edu › java › 11precedence
Operator Precedence in Java
The table below shows all Java 11 operators from highest to lowest precedence, along with their associativity. The table also includes other Java constructs (such as new, [], and ::) that are not Java operators.
🌐
Oracle
docs.oracle.com › javase › tutorial › java › nutsandbolts › operators.html
Operators (The Java™ Tutorials > Learning the Java Language > Language Basics)
As we explore the operators of ... operators in the following table are listed according to precedence order. The closer to the top of the table an operator appears, the higher its precedence....
🌐
UCSD
cseweb.ucsd.edu › ~ricko › CSE11 › Java_Operator_Precedence_Table.pdf pdf
Java Operator Precedence Table Operator Description Associativity () [] .
Java Operator Precedence Table · Operator · Description · Associativity · () [] . method invocation · array subscript · member access/selection · left-to-right · ++ -- unary postfix increment · unary postfix decrement · right-to-left · ++ -- + - ! ~ ( type ) new ·
🌐
GeeksforGeeks
geeksforgeeks.org › java › operator-precedence-and-associativity-in-java
Operator Precedence and Associativity in Java - GeeksforGeeks
July 31, 2025 - The table below illustrates the precedence of operators in decreasing order of magnitude, with the top row representing the highest precedence and the bottom row showing the lowest precedence.
🌐
Programiz
programiz.com › java-programming › operator-precedence
Java Operator Precedence
March 10, 2022 - In Java, the precedence of * is higher than that of -. Hence, the multiplication is performed before subtraction, and the value of myInt will be 4. The table below lists the precedence of operators in Java; higher it appears in the table, the higher its precedence.
🌐
Park
my.park.edu › ICS › Offices › Information_and_Computer_Science › Software_Reference_Tables › Default_Page.jnz
Java Operator Precedence Table - Main View | Default Page | Software Reference Tables | MyPark
The operator groups at the top of the list have higher precedence than the operator groups at the bottom of the list. All operators within a particular group have equal precedence. Most of the operators have left-to-right associativity. That means that if an expression has two or more ...
🌐
Rutgers CS
cs.rutgers.edu › courses › 111 › classes › fall_2011_tjang › texts › notes-java › data › expressions › precedence.html
Operator Precedence - Java
April 25, 2024 - This table gives the precedence of all operators. You may not be familiar with all operators, but take the advice on the right side and only learn a few precedences. Let's look at the expression x = a+b-c*d/e, which can be parenthesized as x = ((a+b) - ((c*d)/e)). Instead of parentheses, we ...
Find elsewhere
🌐
W3Schools
w3schools.com › java › java_operators_precedence.asp
Java Operator Precedence
Java Examples Java Videos Java Compiler Java Exercises Java Quiz Java Code Challenges Java Server Java Syllabus Java Study Plan Java Interview Q&A Java Certificate ... When a calculation contains more than one operator, Java follows order of operations rules to decide which part to calculate first.
🌐
Tutorialspoint
tutorialspoint.com › java › java_operator_precedence_and_associativity.htm
Java Operator Precedence and Associativity
Here, operators with the highest precedence appear at the top of the table, and those with the lowest appear at the bottom. Within an expression, higher precedence operators will be evaluated first.
🌐
Scribd
scribd.com › document › 630230454 › Java-Precedence-Table
Java Operator Precedence Overview | PDF | Computer Programming | Software Engineering
Java Precedence Table - Free download as PDF File (.pdf), Text File (.txt) or read online for free. The document outlines the operator precedence table for Java. It lists various operators from highest to lowest precedence, including parentheses, array subscript, unary operators, multiplication, addition, relational operators, bitwise operators, logical operators, ternary conditional, and assignment operators.
Rating: 3 ​ - ​ 2 votes
🌐
UW Computer Sciences
pages.cs.wisc.edu › ~willb › cs302 › java-operator-precedence.pdf pdf
Operator Precedence in the Java™ Programming Language
Gosling, James, et al. The Java Language Specification, 3e. Addison-Wesley, 2005. Note: operators with the same precedence level in an expression are evaluated based on their associativity.
Top answer
1 of 3
3

Yes, ++ has higher precedence than =. But you need to think of the ++ post-increment operator as 2 operations -- increment the variable and yield the old value -- that happen before the operator with lower precedence, =.

Here is what happens:

  1. Post-increment Operator ++: Increment a.
  2. Post-increment Operator ++: Yield the old value of a.
  3. Operator =: Assign the old value of a to b.

It's equivalent to this code.

int resultOfPostIncrement = a;
a = a + 1;
b = resultOfPostIncrement;
2 of 3
1

As opposed to what many people seem to think, b is NOT assigned before incrementing a when we write int b = a++;. It is assigned the former value of a, but later in the timeline than the actual increment of a.

Therefore, it does not contradict what precedence tells you.


To convince you, here is a little example that convinced me:

int a = 1;
int b = a++ + a++;

At the end, b equals 3, not 2, and a is also 3. What happens because of precedence is:

  • the left a++ is evaluated first, incrementing a, but still evaluated to the former value 1 by definition of the operator
  • the right a++ is evaluated, reading the new value 2 (proving that the first increment already happened), incrementing it to 3, but still evaluating to 2
  • the sum is calculated 1 + 2, and assigned to b

This is because you should see a++ as both an instruction and an expression.

  • the instruction increments a
  • the expression evaluates to the former value of a

It's the same kind of things as in b = a, which also is an instruction and an expression:

  • the instruction assigns the value of a to b
  • the expression evaluates to the assigned value
🌐
Coderanch
coderanch.com › t › 781263 › java › aren-operator-precedence-table
Why aren't 'new' and '.' in the operator precedence table? (Beginning Java forum at Coderanch)
April 25, 2024 - Assignment Operators 15.27. Lambda Expressions 15.28. switch Expressions 15.29. Constant Expressions "new" is covered by 15.9. Class Instance Creation Expressions.  "." is covered by 15.11. Field Access Expressions, and 15.12. Method Invocation Expressions. So, "new" is higher precedence than ".". Anil, for whatever reason, Java doesn't new and .
🌐
Scaler
scaler.com › home › topics › operator precedence in java
Operator Precedence in Java - Scaler Topics
May 4, 2023 - Similarly, we have the operator precedence in java which is a set of rules that tells us the precedence of different operators, and as per the rule operator with higher precedence is evaluated first.
🌐
Dummies
dummies.com › article › technology › programming-web-design › java › programming-java-operator-precedence-153624
Programming Java: Operator Precedence | dummies
July 2, 2025 - The Priority column is probably the most important because it defines the strict order in which Java interprets the symbols displayed in the Operators column. An operator higher in the table always takes precedence over an operator that’s lower in the table.