KnowledgeBoat Logo

Computer Applications

Identify all the errors in the following repetitive statements.

for	(int i = 5; i > 0; i++)
{
    System.out.println("Java");
}

Java Iterative Stmts

4 Likes

Answer

The test expression i > 0 will always remain true and hence, the for loop will become an infinite loop and keep on iterating.

Answered By

3 Likes


Related Questions