AP® Computer Science A

Free Version

Upgrade subject to access all content

Difficult

Array Arithmetic in the Suspense Class

APCSA-TVAJCN

Consider the following class.

public class Suspense
{
    private static int[] x = {8};
    private static int y = 8;

    public static void method1()
    {
        method2(x, y);
        System.out.println(x[0] + y);
    }

    public static void method2(int[] x, int y)
    {
        x[0]+=y;
        y+=x[0];
    }
}

Which of the following is printed as a result of the call Suspense.method1()?

A

16

B

24

C

32

D

40

E

88