Are you taking CLEP classes? Try clep.ai
| 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

Y

B

Z

C

YY

D

XYZ

Hint
Did You Know?
Explain Why
Explain All Answers
Check Answer
Show Correct Answer
Report Question
Mark for review

Question Leaderboard

Not enough data yet to show leaderboard.

No comments yet. Be the first to comment!

AI Tutor

How can I help?

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