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!