The BFOIT Java Programming Class

Java's Precedence Order


Operations in Java have specific precedences; in other words, certain operations always come before others. The following table lists the specific precedences of Java operators. The larger the precedence number the sooner it is evaluated (see evaluation order).

As an example, in the expression ( dollars * 100 + cents ) multiplication will be executed first in an expression since its precedence number is 12, bigger than addition's 11.


Operator Description Precedence Number
++, -- post-increment, post-decrement 16
++, -- pre-increment, pre-decrement 15
~ bitwise complement 14
! logical complement 14
+, - numerical signs 14
( typename ) type conversions, casting 13
*, /, % multiplication, division,
remainder
12
+, - addition, subtraction 11
<<, >>, >>> bit shifts 10
<, <=, >, >= relational 9
==, != equality 8
& bitwise AND 7
^ bitwise EXCLUSIVE OR 6
| bitwise INCLUSIVE OR 5
&& conditional-and 4
|| conditional-or 3
?, : if, else expression 2
=, +=, -=, *=, /= assignment 1


Back to Table of Contents