code:
--------------------------------------------------------------------------------
class Test{public static void main(
String[] arg){int i = 1;int j = i+++i;System.out.println(j); //prints 3}}
--------------------------------------------------------------------------------
since the output is 3 it is evident that the compiler would interpret the line as follows
i + (++i)
hope that helps
Samith.P.Nambiar
----------------------
Hai Nambiar,
Need not be & it is not the case.
j=i+++i = i++ +i;
j=1++ +i; // i assigned 1 and post incremented to 2.
j=1+2; // postincremented value of i is substituted.
j= 3 // The value, 3 is arrived at.
HTH
tvs sundaram
[This message has been edited by tvs sundaram (edited August 13, 2001).]