0
for(int i=0;i<=5;i++)
Why after i++ there is no any semicolon( ; ).i++ is also a statement . when we use while loop there is i++; why not here?
3 Answers
+ 3
All stmts in Java ends with a semicolon .Thats why i++ being a stmt inside while loop comes with a semicolon. Whereas i++ in for loop is written in its iteration slot .
Kindly have a read :
https://www.sololearn.com/learn/Java/2147/?ref=app
0
Plzz can u tell me briefly
0
The things inside the parentheses of for loop are not statements. The syntax of for loop is for(initialization; condition; increment/decrement)
The semicolons are to seperate those three things.
So there is no need for a semicolon at the end since there is nothing after that