Can someone please explain what is going on in this method?
class test{ public static void main(String args[]) { int[] x = new int[4]; int[] xy = new i
You can use the for-loop instead:
for(int i = 0 ; x.length > i; i ++) { xy[i] += 1; }
If you want to still use for each then here is the example
a[]={1,2,3,4}; for(int i:a) { println(i); }
Hope it helps!