Assume array items contains the integer values 0, 2, 4, 6 and 8. Which of the following uses the enhanced for loop to display each value in array items?
a.
for (int i = 0; i < items.length; i++)
System.out.prinf("%d%n", items[i]);
b.
for (int i : items)
System.out.prinf("%d%n", items[i]);
c.
for (int i : items)
System.out.prinf("%d%n", i);
d.
for (int i = 0 : items.length)
System.out.prinf("%d%n", items[i]);
c.
for (int i : items)
System.out.prinf("%d%n", i);
You might also like to view...
When a chart is selected, the Style and Color galleries can be displayed by clicking the ________ button that appears to the right of the chart
Fill in the blank(s) with correct word
Which of the following does not apply to an istringstream object?
a. Data is stored in the object as characters. b. Input from the object works identically to input from any file stream. c. Data in a string can be appended to it. d. It is used to inputs data from a string in memory to program variables.