A

Admin • 828.43K Points
Coach

Q. Which is the correct syntax of a for-each loop?

  • (A) for(int i: array)
  • (B) for i in array
  • (C) foreach(int i in array)
  • (D) for each(int i; array)
  • Correct Answer - Option(A)
  • Views: 13
  • Filed under category Java
  • Hashtags: Java Loops

Explanation by: Admin
for(type var : collection) is the correct for-each loop syntax in Java.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.