Skip to content
Sharp

Java Threading · interview question

Why does calling the awaitTermination() method on an ExecutorService change runtime behavior?

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

Correct answer

B. It blocks until all tasks have completed execution after a shutdown request.

Why

awaitTermination() is used after shutdown to block the calling thread until all tasks have completed execution or the timeout occurs, ensuring a clean shutdown process.

Test yourself on Java Threading

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

Start free test
All Java Threading questions →