Suppose x = 1, y = -1, and z = 1. What is the output of the following statement? (Please indent the statement correctly first.)
```
if (x > 0)
if (y > 0)
System.out.println("x > 0 and y > 0");
else if (z > 0)
System.out.println("x < 0 and z > 0");
```
a. x > 0 and y > 0;
b. x < 0 and z > 0;
c. x < 0 and z < 0;
d. no output.
b. x < 0 and z > 0;
You may copy the code to an IDE such as NetBeans or Eclipse and reformat it to see how it is correctly indented. The else clause matches the most recent if clause. So, it actually displays x < 0 and z > 0.
Computer Science & Information Technology
You might also like to view...
The stream that is automatically available to your Java code is:
a. System.out b. System.in c. System.err d. all of the above
Computer Science & Information Technology
PowerPoint provides an inline spelling checker that automatically indicates possible spelling errors with wavy _____ underlines.
A. grey B. blue C. red D. green
Computer Science & Information Technology