+ 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

10th Dec 2017, 4:17 AM
Muhd Khairul Amirin
Muhd Khairul Amirin - avatar
1 Réponse
+ 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
10th Dec 2017, 4:28 AM
Jesse Bayliss
Jesse Bayliss - avatar