Difficulty: Easy
Correct Answer: x z
Explanation:
Introduction / Context:
The task probes differences between primitive boolean and wrapper Boolean, the effect of booleanValue(), and the semantics of the single ampersand operator (&) in boolean expressions, which evaluates both operands but still returns a boolean result.
Given Data / Assumptions:
Concept / Approach:
After the first if block, b2 becomes true and "x " is printed. The second condition evaluates (b1 & b2) → (false & true) which is false, so the body is skipped. Finally, println prints "z" on the same line after a space from the previous print.
Step-by-Step Solution:
Verification / Alternative check:
Replacing & with && would short-circuit, but the result would still be false for (false && true), producing the same printed tokens.
Why Other Options Are Wrong:
Common Pitfalls:
Confusing & (non-short-circuit) with && (short-circuit); misunderstanding wrapper vs primitive behavior.
Final Answer:
x z
Discussion & Comments