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
Identify all the errors in the following repetitive statements.
while (z < 1 && z > 100) { a = b; }
What are the essential parts of a looping control structure?
How are these statements different from each other:
(i) break
(ii) continue
(iii) System.exit(0)
Identify all the errors in the following repetitive statements.
while (x == y) { xx = yy; x = y; }