sequence point concept in java

后端 未结 2 508
栀梦
栀梦 2020-12-06 02:25

I am new to Java and have background of C.I am going through Khalid Moughal\'s book. On page 126 he gives an example as

   int i = 10;

   int k = ++i + --i         


        
2条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-06 02:53

    No, there are no concept of sequence-points in java and the order of is fully defined. Generally speaking, expressions are evaluated from left to right.For formal definition, you can read JLS, section 15.7 about the evaluation order. See this link.

提交回复
热议问题