+ 4
Explaination Part 2. Please help me.
int i; for (int i=0;i<10;i+=5){} System.out.println(i); Output is 10. Please explain it for me
1 Answer
+ 4
The output is not 5. This won't compile because "i" is already declared. If you fix that, the output is 10.
0) initial value of i is 0; loop once; increment by 5
1) i is now 5; continue looping; increment by 5
2) i is now 10; stop looping
https://code.sololearn.com/cd6A73k4JJkD/?ref=app