This question is from a mock exam :
public class q5 {
public static void main (
String args[]) {
int a [] = { 4,5,9,8,6,6,0};
int i=1;
a[i] = i += a[i++];
System.out.println (a[i]);
System.out.println (i);
}
}
The output is 0 and 6
---------------------------------------------------------------
a[i] = i += a[i++];
This will be resoved as a[i] = (i = (i + a[(i++)]))
Why is the array element a[i] not assigned the value of i (i.e 6)
Can any one explain me this
---------------------------------------------------------------
}