Skip to content
Sharp

Core Java · interview question

Given the following method signature, what is the responsibility of the caller regarding exception handling?

Multiple choiceHardchapter-6-curatedpremiumcore-javathrow-throws-and-propagation
java
public void readFile() throws IOException { /* ... */ }
Choose one answer
Answer and explanation

Correct answer

B. The caller must handle or declare the IOException.

Why

Since IOException is a checked exception, the caller must either handle it with a try-catch block or declare it in its own method signature using 'throws'.

Test yourself on Core Java

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

Start free test
All Core Java questions →