0
What is the output and how?
int []a = {1,2,3,4,1}; for(int n : a) a[n] = 0; for(int n : a) System.out.println(n);
2 Antworten
+ 4
The output is 00301 :
- 1st element is 1 : a[1] = 0 => 10341
- 2nd element is now 0 : a[0] = 0 => 00341
- 3rd element is 3 : a[3] = 0 => 00301
- 4th element is now 0 : a[0] = 0 => 00301
- 5th element is 1 : a[1] = 0 => 00301
+ 1
Thnx