Here I have the following code snippet:
int a,b,x;
a=b=1;
x=a+++b;
Now the value xwill be 2, because it awill increase first, and then added to b.
The following is a compiled bytecode:
0 iconst_1
1 dup
2 istore_2 [b]
3 istore_1 [a]
4 iload_1 [a]
5 iinc 1 1 [a]
8 iload_2 [b]
9 iadd
10 istore_3 [x]
Thus, the expression will be equivalent x = (a++) + b.
Now, another expression x=a++++bwill not compile due to the maximum munch rule. It will become x = (a++) ++ band therefore a compilation error.
Is the above behavior x=a+++bdue to the priority of the ++ operator or because of the max munch rule ?