?

AP® Computer Science A

Free Version

Upgrade subject to access all content

Difficult

Nested Method Calls

APCSA-D4NULA

Consider the following class.

public class Z
{
    public static int A(int x)
    {
        x *= -x;
        return(x);
    }

    public static int B(int x)
    {
        x += x;
        return(x);
    }

    public static int C(int x)
    {
        x/=2;
        return(x);
    }
}

Which of the following is returned as a result of calling Z.C(Z.A(Z.B(Z.C(5)))) executed from another class ?

A

-8

B

-2

C

0

D

2

E

8