The question below is at operators in Dan's Topic exam. The output is 1. The question looks so tricky. How do I group it? And could you give me some explanation of it in detail?
Each time execute part caculation, the variable 'i' is being changed? I think so.
Some my approch,
a compound assignment expression of the form E1 op= E2 can be rewritten as E1=(T)((E1)op(E2)) where T is the type of E1.
so i = i + (~i - -i * ++i + i-- % ++i * i++)
then i = 1 + (~i - -i * ++i + i-- % ++i * i++)
...
class F {
public static void main (
String []s) {
int i = 1;
i += ~i - -i * ++i + i-- % ++i * i++;
System.out.print(i);
}
}
Thank you for your help?