Skip to content
Sharp

Concurrency basics · interview question

How can you handle exceptions in a CompletableFuture without terminating the chain?

Multiple choiceMediumchapter-15-curatedpremiumconcurrencycompletablefuture
Choose one answer
Answer and explanation

Correct answer

D. .exceptionally()

Why

The exceptionally() method allows you to handle exceptions that occur during the execution of a CompletableFuture. It enables you to provide an alternative result and continue the chain.

Test yourself on Concurrency basics

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

Start free test
All Concurrency basics questions →