Skip to main content

Unit 4 · Data Collections

Array Mutation

Array Mutation MCQ Practice

Question 1 of 15

Answered 0 of 15

Choose one answer.

What is printed by the following code segment?

public class ArrayMutationContext
{
    public static void runExample()
    {
        int[] a = {1, 2, 3};
        a[1] = a[0] + a[2];
        System.out.print(a[0] + " " + a[1] + " " + a[2]);
    }

    public static void main(String[] args)
    {
        runExample();
    }
}
Choose one answer.