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);

cd 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++);

Computer Science & Information Technology

You might also like to view...

The term ________ protection means that your computer is continuously monitored at all times for suspicious activity such as viruses and spyware

A) timeless B) real-time C) just in time D) uninterrupted

Computer Science & Information Technology

This is an attack where an attacker can seamlessly place itself in the middle of the conversation of others

What will be an ideal response?

Computer Science & Information Technology