Computer Applications
What is an empty statement? Explain its usefulness.
Java Iterative Stmts
4 Likes
Answer
Empty statement consists only of a semicolon ;
. It is useful when we want to make a loop an empty loop.
To make a for loop an empty loop, we write the following code:
for (int i = 1 ; i <=10 ; i ++);
Answered By
2 Likes
Related Questions
What are the differences between while loop and do-while loop?
Identify all the errors in the following repetitive statements.
while (x == y) { xx = yy; x = y; }
Identify all the errors in the following repetitive statements.
while (z < 1 && z > 100) { a = b; }
Convert the following for loop statement into the corresponding while loop and do-while loop:
int sum = 0; for (int i= 0; i <= 100; i++) sum = sum + i;