Java and Java Operator Precedence Operator binding

Java and Java Operator Precedence Operator binding:

A, Java operator precedence determines the order of execution of the operation expression, and expression is connected with the operator's compliance with the rules of Java expression;

The expression: x + 2 * y + 10 + 5 * (z + 20); 

Two, Java operator binding determines the level of the same order parallel operators;

Arithmetic operators such as addition and subtraction operators: 2 + 8-5; The binding subtraction operator is left to right, using the calculated first 2 + 8 at minus 5 calculated;

 

The following table summarizes the priority of the Java conventional binding operator:

priority description Operators Associativity
1 Separator [ ]  ( ) . , ;    
2 Classified objects, increment decrement operators, Logical NOT instanceof  ++ -- ! From right to left
3 Multiplication and division arithmetic operators *  / From left to right
4 Subtraction arithmetic operators +  - From left to right
5 Shift operator >>  <<  >>> From left to right
6 Size relational operators > >= < <= From left to right
7 Equal relational operators ==  != From left to right
8 Bitwise AND & From left to right
9 Bitwise XOR ^ From left to right
10 Bitwise or | From left to right
11 Logical AND operator && From left to right
12 Logical OR operator || From left to right
13 Ternary operator ? : From left to right
14 Assignment Operators = From right to left

Wherein requires detailed knowledge of the monocular, binary operator;Arithmetic operators;Relational operator;Logical operators; use,

You can visit the link: https://blog.csdn.net/LagerSwan/article/details/104080208 

 

 

Published 27 original articles · won praise 7 · views 3062

Guess you like

Origin blog.csdn.net/LagerSwan/article/details/104081548
Recommended