Java Operator Precedence Flashcards
What’s of the top (15th) precedence?
() - Parentheses
[] - Array subscript
· - Member selection
What’s of the last (1st) precedence?
= -Assignment \+= -Addition Assignment -= -Subtraction Assignment *= -Multiplication Assignment /= -Division Assignment %= -Modulus Assignment
What does Precedence even mean?
it’s the condition of being more important that something; priority
in this case, the higher the #, the higher it is in priority
14th precedence?
? : -conditional (ternary)
13th precedence?
\++ -unary Pre-Increment -- -unary Pre-Decrement \+ -unary Plus - -unary Minus ! -unary Logical Negation ~ -unary Bitwise Complement (type) -unary Type Cast
12th precedence?
- -Multiplication
/ -Division
% -Modulus
11th precedence?
+ -Addition
- -Subtraction
10th precedence?
«_space; -bitwise Left Shift
» -bitwise Right Shift w/Sign Extension
»> -bitwise Right Shift w/Zero Extension
9th precedence?
< -relational Less than <= -relational Less than or Equal > -relational Greater than >= -relational Greater than or Equal instanceof -Type comparison (objects only)
8th precedence?
== -relational Is Equal to != -relational Is Not Equal to
7th precedence?
& -bitwise AND
6th precedence?
^ -bitwise exclusive OR
5th precedence?
-bitwise inclusive OR
4th precedence?
&& -logical AND
3rd precedence?
|| -logical OR