Java Foundations — Question 13
You have been asked to develop a Java program that prints the elements of an array in reverse order.
Which looping statement cannot be used to meet the requirement?
Answer options
- A. enhanced for
- B. standard for
- C. while
- D. do-while
Correct answer: A
Explanation
The enhanced for loop is designed for iterating over collections and arrays in a forward direction, making it unsuitable for reversing an array. In contrast, both the standard for loop, while loop, and do-while loop can be utilized to traverse an array in reverse order effectively.