+ 1

for(int[] a:x)

how it works??

2nd Dec 2017, 5:40 AM
Vikas Patel
Vikas Patel - avatar
2 Answers
+ 2
for every element in array a do something. each element in each loop will be saved in variable x. So for example you have array a =(1,2,3,4) and for(int[] a: x ){ System.out.print(x)} will give output 1234
2nd Dec 2017, 6:47 AM
Bartek Nowacki
Bartek Nowacki - avatar