Unit 4 · Data Collections
Array Traversal
Array Traversal MCQ Practice
Question 1 of 15
Answered 0 of 15
Choose one answer.
What is printed by the following code segment?
public class ArrayTraversalContext
{
public static void runExample()
{
int[] a = {4, 1, 6};
int s = 0;
for (int v : a)
{
s += v;
}
System.out.print(s);
}
public static void main(String[] args)
{
runExample();
}
}