(Solved):This code contains ERRORS! Find the Error: Print the numbers 1 through 10. for (int count = 1, count less or equal to 10, count++;) { System.out.println(count); count++; } View Answer…

 

Question

This code contains ERRORS! Find the Error:

Print the numbers 1 through 10.

for (int count = 1, count <= 10, count++;)

{

System.out.println(count); count++;

}

 

EXPERT ANSWER

Java Code:

public class HelloWorld{
     public static void main(String []args){
        for (int count = 1 ; count <= 10 ; count++)
            {
            System.out.println(count);
            }
     }
}

Output:

1
2
3
4
5
6
7
8
9
10

The errors are in the following statements:

Statement 1

for 

Scroll to top