+ 1

Can somebody describe me this programm? I don't understand what the output is and how this programm works. Thanks.

int[] a={8, 3, 2}; for (int i=1; i <2; i++) { a[0] *= a[0] } System.out.print(a[0]); Tanks for help! German answers are better than eglish. But I understand both.

7th Mar 2017, 3:12 PM
nwytg
2 Answers
+ 5
a0 is the first value in the index which is 8. I=1 and must be less than 2, so the for loop will run once. so 8*8 is 64.
7th Mar 2017, 3:17 PM
Andre van Rensburg
Andre van Rensburg - avatar
+ 1
oh nice thx
7th Mar 2017, 3:28 PM
nwytg