Difficulty: Easy
Correct Answer: boolean b3 = false;
Explanation:
Introduction / Context:
Java requires booleans to be assigned the literals true or false. There is no implicit numeric or string conversion to boolean.
Given Data / Assumptions:
Concept / Approach:
Only boolean literals true/false or boolean expressions can initialize a boolean. Numeric 0/1, string literals, or non-existent helpers like Boolean.false() are invalid in Java.
Step-by-Step Solution:
Verification / Alternative check:
Compile each declaration; only Option C succeeds.
Why Other Options Are Wrong:
They use incompatible types or non-existent APIs.
Common Pitfalls:
Transferring habits from C/C++ (0/1 to represent booleans) to Java, where it is not allowed.
Final Answer:
boolean b3 = false;
Discussion & Comments