Question: Question 10 What does the following code do? Assume names is an array of String values. for (int index = names.length-1; index >= 0; index--)
Question 10
What does the following code do? Assume "names" is an array of String values.
for (int index = names.length-1; index >= 0; index--)
System.out.println(names[index]);
|
| A. | It will generate an error because index cannot be zero. |
|
| B. | It prints the values stored in names backwards, except for the last value in the array. |
|
| C. | It prints the values stored in names backwards. |
|
| D. | It does not print out anything because the index should be increased not decreased. |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
