Analyze the following code:
```
public class Test {
public static void main (String args[]) {
int i = 0;
for (i = 0; i < 10; i++);
System.out.println(i + 4);
}
}
```
a. The program has a compile error because of the semicolon (;) on the for loop line.
b. The program compiles despite the semicolon (;) on the for loop line, and displays 4.
c. The program compiles despite the semicolon (;) on the for loop line, and displays 14.
d. The for loop in this program is same as for (i = 0; i < 10; i++) { }; System.out.println(i + 4);
c. The program compiles despite the semicolon (;) on the for loop line, and displays 14.
d. The for loop in this program is same as for (i = 0; i < 10; i++) { }; System.out.println(i + 4);
This is a logic error. System.out.println(i + 4) is not a part the for loop because the for loop ends with the last semicolon at for (i=0; i < 10; i++);
You might also like to view...
Which chart type is best when you want to chart two unrelated data types?
A) Pie chart B) Radar chart C) Combo chart D) Line chart
What are the differences between a stack and a queue?
What will be an ideal response?