The whole program is here
class plus
{
public static void main(String args[])
{
int array[] = {0,1,2,3,4,5};
int j =1 ;
array[j] = array[++j]+10;
for (int m=0; m<array.length; m++)
System.out.println(array[m]);
}
}
A book tells me to calcuate the right side ++j first and become array[2] = 12;
But the jdk1.4 shows another result
Would anyone explain it?
class plus
{
public static void main(String args[])
{
int array[] = {0,1,2,3,4,5};
int j =1 ;
array[j] = array[++j]+10;
for (int m=0; m<array.length; m++)
System.out.println(array[m]);
}
}
A book tells me to calcuate the right side ++j first and become array[2] = 12;
But the jdk1.4 shows another result
Would anyone explain it?