Question
Which practice avoids a common mistake with Checked vs Unchecked Exceptions?
- Ignore the Checked vs Unchecked Exceptions issue and rely on team discipline instead of APIs or contracts.
- Silence the Checked vs Unchecked Exceptions problem by using raw types, broad catches, or shared mutable state.
- Do not turn every domain problem into a checked exception and burden every API boundary with boilerplate.
- Prefer the version of Checked vs Unchecked Exceptions that makes behavior less predictable as long as the code compiles.
Hint
Look for the option that protects correctness instead of hiding the problem.
Answer and rationale
Correct answer: C. Do not turn every domain problem into a checked exception and burden every API boundary with boilerplate.
Do not turn every domain problem into a checked exception and burden every API boundary with boilerplate. This is a common failure mode in real Java code and a frequent interview follow-up.
Track: Java