ICSE Class 10 Computer Applications
Question 56 of 76
Revising Basic Java Concepts — Question 60
Back to all questions 60
Question Question 37
Find the error
for(count = 0, count < 5, count = count + 1)
System.out.println("This is count:" + count);
System.out.println("Done!"); The errors are as follows:
- The variable count is not declared. It needs to be declared before it can be used.
- The syntax of 'for' loop requires semicolons ( ; ) as separators, and not comma ( , ). The correct code is as follows:
for(int count = 0; count < 5; count = count + 1)
System.out.println("This is count:" + count);
System.out.println("Done!");