Confusion rose because of this post. The author updated his post, and the result became clear. Conclusion: Java evaluates expressions from left to right
Closed!
As evaluation of expression is done from right to left the following code should store 5
in j
:
int i=2;
int j=++i+i++;
System.out.println(j);
But I get 6 as the output, which forces me to re-think the right to left evaluation idea. Kindly explain the theory here.