A question on Java Syntax.

Hii everyone,
Many times I have seen the syntax in Java like

for (int i=0; i<n; i++) {
;
}

Everything is working fine here but I don’t understand why using a semicolon inside the for loop.We can leave it empty also?

it is not required to put semicolon in a for loop if there is nothing written in it.
I am not that well with java but c++ it is not required and the coding logic is same everywhere .That might happened due to some bug or something.:slight_smile:

it is not required to put semicolon in a for loop if there is nothing written in it.
I am not that well with java but c++ it is not required and the coding logic is same everywhere .That might happened due to some bug or something.:slight_smile:

//