| preferred AP College board partner for AP classes
medium Solved by 2 students
Tracing Nested If Statements
< Prev
Next >

Consider the following message method.

public static void message(int a, int b, int c)
{
    if (a < 10)
    {
        if (b < 10)
        {
            System.out.print("X");
        }
        System.out.print("Y");
    }
    if (c < 10)
    {
        if (b > 10)
        {
            System.out.print("Y");
        }
        else
        {
            System.out.print("Z");
        }
    }
}

What is printed as a result of the method call message(5, 15, 5)?

A

XYZ

B

Y

C

Z

D

YY

Hint
Did You Know?
Explain Why
Explain All Answers
Check Answer
Show Correct Answer

Question Leaderboard

Not enough data yet to show leaderboard.

AI Tutor

How can I help?

APFIVE © 2020.
Email: apfive@apfive.org|Privacy Policy