Skip to content
Sharp

Core Java · interview question

In the provided code, why might the exception be swallowed?

Multiple choiceHardchapter-6-curatedpremiumcore-javacode-reading-with-exceptions
java
try { processPayment(); } catch (Exception e) { /* silently swallowed */ } finally { System.out.println("Payment process finished."); }
Choose one answer
Answer and explanation

Correct answer

B. The exception is caught but not logged or rethrown.

Why

The exception is swallowed if it is caught without any action like logging or rethrowing. This means the exception is handled silently, and the program continues execution, potentially leading to hidden issues.

Test yourself on Core Java

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

Start free test
All Core Java questions →