- 1
How arr comes after x :
5 ответов
+ 8
Please post code.
+ 8
@r
This is a for each loop. Iterates through the whole array. You need to init the array before looping through it.
0
int total =0;
for(int x : arr){
total += x;
}
0
enhanced for loop
0
total question should be like below:
int[] arr={2,3,5,7};
int total=0;
for (int x: arr) {
total +=x;
}
but they have removed the first line. Hope now you understood this