c) What is the type of errors when adding a semicolon at the end of the for clause before the loop body as shown below: ( 1 mark )
for (int i=0; i<10; i++);
{
System.out.println("i is " + i);}
Answers
Answered by
2
Answer:
Semicolon is a legitimate statement called null statement * that means "do nothing". Since the for loop executes a single operation (which could be a block enclosed in {} ) semicolon is treated as the body of the loop, resulting in the behavior that you observed. ... ... do nothing (semicolon)
Explanation:
Similar questions