LearnFrenzy
Sign in Take a free test

Concurrency and Executors · Concurrency and Executors MCQ · Question 7

ExecutorService in try-with-resources Answer, explanation & discussion

  • MCQ
  • Medium
  • 0 comments
  • Answer explained
  • Moderated community
Question 7 Back to Exercise

Since Java 19, what happens when an ExecutorService used in try-with-resources is closed?

  • A Running tasks are killed
  • B It shuts down and waits for submitted tasks to finish Correct
  • C Nothing – it is not AutoCloseable
  • D It throws
Correct Answer: Option B

ExecutorService now extends AutoCloseable.

Discussion & Comments 0

Share your method, a shortcut, or ask about a step you didn't follow.

No comments yet. Be the first to share your solution!

Post your comment

Comments appear after a quick review by our team.

Search LearnFrenzy

Esc

Quick links