int arrayExample = {10, 20, 30, 40, 50};
for (int i = 0; i < arrayExample.length; i++)
arrayExample[i]++;
System.out.println(Arrays.toString(arrayExample));
arrayExample = new int[]{10, 20, 30, 40, 50};
for (int i = 0; i < arrayExample.length; i++)
arrayExample[i++]++;
System.out.println(Arrays.toString(arrayExample));
produces the following output
[11, 21, 31, 41, 51]
[11, 20, 31, 40, 51]
Why does the second looop increment the elements at index 0, 2 and 4 but not index 1 and 3? Shouldnt it be the opposite (incrementing index 1 and 3 but ignoring the rest?)