Skip to content
Sharp

Java Threading · interview question

Which method in ExecutorService can be used to retrieve results of multiple tasks at once?

Multiple choiceMediumchapter-15-curatedpremiumjava-threadingexecutorservice
Choose one answer
Answer and explanation

Correct answer

A. InvokeAll()

Why

The invokeAll() method in ExecutorService is used to execute a collection of tasks and retrieve their results. It blocks until all tasks have completed, returning a list of Futures holding their results.

Test yourself on Java Threading

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

Start free test
All Java Threading questions →