?

AP® Computer Science A

Free Version

Upgrade subject to access all content

Moderate

Logical Operator Evaluation within Method Calls

APCSA-YTKPMV

Consider the following methods.

public static boolean mystery1(int x, int y, int z)
{
    return x == 5 || y == 5 && z == 5;
}

public static boolean mystery2(int x, int y, int z)
{
    return (x == 5 || y == 5) && z == 5;
}

Which of the following methods calls returns false?

A
mystery1(4,5,5)
B
mystery1(5,4,5)
C
mystery1(5,5,4)
D
mystery2(5,5,4)
E
mystery2(4,5,5)