i think
you should read the array section a bit more carefully coz there is no scope for any doubt about the correct answer to this if you have. i'm telling you htis coz for starters i also had just skimmed thru the array portion, thinking it to be all like in some earlier languages i had done. but it obviosly wasn't . just do it coz it's just half an hour stuff.
regarding the question:
the indexes of an array declared as : int a[] = new int[n] are
0, 1, 2, ..., n-1
thus in this prob, initially a[0] = 3, a[1] = 6
you assign 9 both to i and a[i] and thus the output.
trying to access a[2] will throw an ArrayIndexOutOfBoundsException