Skip to content
Sharp

Core Java · interview question

Why is it generally a bad idea to catch the Exception class directly in Java?

Multiple choiceHardchapter-6-curatedpremiumcore-javacode-reading-with-exceptions
Choose one answer
Answer and explanation

Correct answer

A. It can mask programming errors and bugs.

Why

Catching the Exception class can mask programming errors by catching all exceptions, including those that are better handled specifically. This can make debugging difficult because the root cause of an error might be hidden.

Test yourself on Core Java

A free test with instant, explained results. No account needed.

Start free test
All Core Java questions →