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

Consider the following 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 call message(5, 15, 5)?

A

XYZ

B

YY

C

Y

D

Z

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

Question Leaderboard

Rank
User
Correct Count
Attempt Count
Time
Score
#1hitrishabhatia23 0m 00s 190
#2kazvin.tjakradinata22 0m 54s 146
#3y.seong202722 0m 56s 144
#4lsj0803092211 0m 00s 100
#5suhanakochhar00611 0m 54s 46
#6tellabhinaya11 1m 31s 9
#7namansoin00011 5m 29s -229
#8bommasam00033 58m 37s -3,217
Items per page:
10
1 – 8 of 8

AI Tutor

How can I help?

APFIVE © 2020.
Email: [email protected]|Privacy Policy