What is i printed?
```
public class Test {
public static void main(String[] args) {
int j = 0;
int i = ++j + j * 5;
System.out.println("What is i? " + i);
}
}
```
a. 0
b. 1
c. 5
d. 6
d. 6
Operands are evaluated from left to right in Java. The left-hand operand of a binary operator is evaluated before any part of the right-hand operand is evaluated. This rule takes precedence over any other rules that govern expressions. Therefore, ++j is evaluated first, and j is now 1. Then j * 5 is evaluated, returns 5. So, i is 6.
You might also like to view...
Which of the following statements is false?
a. In top-down, stepwise refinement, the top is a single statement that conveys the program’s overall function but rarely conveys enough detail from which to write a program. b. The top specifies what should be done, but not how to implement it. c. In the refinement process, we decompose the top into a sequence of smaller tasks—a process sometimes called divide and conquer. d. In the top-down, stepwise refinement process for developing algorithms, each refinement represents another portion of the algorithm.
When the image inside a frame is selected, the ____________________ displays options for transforming the frame contents.
Fill in the blank(s) with the appropriate word(s).
Choose the correct number expression in the following sentence. _____members will be selected to represent the club at the state competition.
A. ?11 B. ?Eleven
All components of an array are of the same data type.
Answer the following statement true (T) or false (F)