Skip to content
Sharp

Exceptions · interview question

What should you do to ensure a custom exception class is serializable?

Multiple choiceEasychapter-6-curatedpremiumexceptionscause-chaining-and-error-context
Choose one answer
Answer and explanation

Correct answer

B. Implement the Serializable interface.

Why

To ensure a custom exception class is serializable, it should implement the Serializable interface. This allows the exception to be transmitted over a network or saved for later use.

Test yourself on Exceptions

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

Start free test
All Exceptions questions →