I am trying out the following Java snippet:
int[] testArray={10,20,30,40}; int i= 0; testArray[i++]= testArray[i++]+1; System.out.println("The value of i: "+i); for(int i1=0;i1<testArray.length;i1++) { System.out.println(testArray[i1]); } } With i=0, the output values of the array are: 21, 20,30,40 21, 20,30,40
I can,tcan't understand this output because the output should be: 10, 11,30,40 testArray[0]+1 10, 11, 30, 40
testArray[0]+1 would be 1111 and it would be then assigned to testArray[1]testArray[1] but this is not the case. Can anybody explain the output?