I have trouble understanding operator precedence in post increment and pre increment operators. I did my research and found below article in StackOverFlow
Precedence of ++ and -- operators in Java
But it does not answer my questions.
In the code below
d = 1; System.out.println(++d * d++);
According to one of the answer by @PaĆlo Ebermann the above expression is evaluated as ++d * d++ => (++d) * (d++) and then evaluated from left to right which gives answer as 2*2=4 which is ofcourse what the java says when I print it.
My understanding is I believe that the expression is evaluated as ++d * d++ => (++d * (d++)) since d++ has higher precedence than ++d which gives answer as 3*1=3.
EDIT: Another example to support my claim- Consider expression 2+3*5 which gets evaluated to (2+(3*5)) and evaluation happens in that manner(Multiplication followed by addition). But consider this expression int i=1;sysout(i+i++); Here i+i++ must change to (i+(i++)). The post increment must increase i by two(similar to multiplication) which is assigned to i which makes 2+1=3 but the output is 2.
Please clarify what I am thinking wrong here in relation to precedence to evaluation order