I have this expression:
y[i] = ( z[i] == a && b || c )
Which of these elements (&&
, ||
, ==
) have the priority?
Can you please show the order of operations with brackets?
First ==
, then &&
, then ||
.
Your expression will be evaluated as y[i] = (((z[i] == a) && b) || c)
.
https://docs.oracle.com/javase/tutorial/java/nutsandbolts/operators.html
Alex
The priority list:
- ==
- &&
- ||
This would be :
y[i] = ((( (z[i]) == a )&& b) || c)
The actual expression is evaluated as
y[i] = ( ((z[i] == a) && b) || c )
You probably want to look here for more info on operator precedence. https://docs.oracle.com/javase/tutorial/java/nutsandbolts/operators.html
Here's the full list of ALL OPERATORS:
Full list of operators in Java
Got it from "Java ist auch eine Insel" = "Java is also an island"
来源:https://stackoverflow.com/questions/33583606/which-has-more-priority-or-or