Skip to content
Sharp

Concurrency basics · interview question

When chaining CompletableFutures, which method allows you to perform an action without returning a result?

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

Correct answer

D. .thenAccept()

Why

.thenAccept() is used to perform an action on the result of a CompletableFuture without returning a value. It acts as a consumer, allowing side effects or downstream processing without altering the result type.

Test yourself on Concurrency basics

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

Start free test
All Concurrency basics questions →