Tracing Nested If Statements
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
Question Leaderboard
Not enough data yet to show leaderboard.
APFIVE