What is the output of the following code?
int x = 0;
if (x < 4) {
x = x + 1;
}
System.out.println("x is " + x);
a. x is 0
b. x is 1
c. x is 2
d. x is 3
e. x is 4
b Since x is 0 before the if statement, x < 4 is ture, x becomes 1 after the statement x = x + 1 . The correct answer is B.
You might also like to view...
A(n) ____ is the template or description a programmer uses to create an object.
A. class B. access modifier C. function D. parameter
Before you publish a Web site, you should test your site by viewing it in as many different browsers as possible.
Answer the following statement true (T) or false (F)
The list of modifications that users have made to a shared workbook is called a(n) ____.
A. change history B. interactivity record C. change worksheet D. modification history
What does the address operator do?
What will be an ideal response?