KnowledgeBoat Logo
|

Computer Applications

Identify all the errors in the following statements.

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

Java Iterative Stmts

3 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

2 Likes


Related Questions