Parentheses and Operator Hierarchy of operators in Java Programming
Previous | Home | Next |
Java has well-defined rules for specifying the order in which the operators in an expression are evaluated
when the expression has several operators.
For example, multiplication and division have a higher precedence than . addition and subtraction.
Expressions that are written will generally consists of several operators. The rules of precedence decide the order in which operator is evaluated in any given expression.
ORDER OF PRECEDENCE OPERATORS
1 parenthesis like (),[],{}
2 unary operators like ++,-,+,!,
3 multiplicative * / %
4 additive +,-
5 shift >>>>
6 relational >=, <=,<,>
7 equality ==,!=
8 bit wise AND &
9 bit wise exclusive OR ^
10 bit wise inclusive OR |
11 logical AND&&
12 logical OR ||
13 ternary ?:
Previous | Home | Next |