Java OCA OCP Practice Question 1074

Question

Which of the following statements is/are true?

A for-each loop can iterate through an array starting

  • I. from index 0.
  • II. from the end.
  • A. Only I
  • B. Only II
  • C. Both statements
  • D. Neither statement


A.

Note

With a for-each loop, the loop order is determined for you.

With an array, this means starting with index 0, and Option A is correct.

A traditional for loop allows you to control the order and iterate in either order.




PreviousNext

Related