Java OCA OCP Practice Question 443

Question

Suppose myArray is an array containing floats.

Which of the following are valid loop control statements for processing each element of myArray?

  • A. for (float f:myArray)
  • B. for (int i:myArray)
  • C. for (float f::myArray)
  • D. for (int i::myArray)


A.

Note

Option A demonstrates the correct syntax of an enhanced for loop, traversing the elements of an array of floats.




PreviousNext

Related