0

Can someone explain this arrays output to me?

int arr[ ] = new int[3]; for (int i = 0; i < 3; i++) { arr[i] = i; } int res = arr[0] + arr[2]; System.out.println(res);

2nd Mar 2018, 8:46 PM
Sebastian Sivertsen
Sebastian Sivertsen - avatar
3 Answers
0
So the for loop isn't used? What is with the body of the for loop arr[i] = i; ?
2nd Mar 2018, 9:07 PM
Sebastian Sivertsen
Sebastian Sivertsen - avatar
0
Can you maybe try explain to me step by step, I still dont understand it.
2nd Mar 2018, 9:21 PM
Sebastian Sivertsen
Sebastian Sivertsen - avatar
0
I understand it, thank you so much!
2nd Mar 2018, 9:31 PM
Sebastian Sivertsen
Sebastian Sivertsen - avatar