开发者

java.sequence processing operators?

I know that the operators &&, << is processed from left to right and ?: - rigth to left.

So, my question: where i can find information about this?

I very need find information a开发者_运维知识库bout this in official docs, but i cant find...


That * is processed before + in a + b * c is called "operator precedence"; * has higher precedence than +.

The Java™ Tutorials - Operators (while not the authoritative documentation) lists the operator precedence in a table, and notes that

All binary operators except for the assignment operators are evaluated from left to right; assignment operators are evaluated right to left.


The actual documentation is in Java Language Specification Chapter 15 - Expressions, but it is not at all readable. The documentation notes that

Precedence among operators is managed by a hierarchy of grammar productions. The lowest precedence operator is the arrow of a lambda expression (->), followed by the assignment operators. Thus, all expressions are syntactically included in the LambdaExpression and AssignmentExpression nonterminals:

There is no table of operator precedence in the Java Language Specification itself; instead the operator precedence is revealed indirectly in the grammar productions.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜