Questions about parallelism in Java are very popular on job interviews. I have one for you today. Check forty sixth question of full-stack dev quiz to check if you know parallelism in Java well enough.
ExecutorService from JDK has a method invokeAll that gets a collection of Callable tasks. What that method does? Choose one the best answer.
- starts executing the tasks,
- queues the tasks for execution,
- executes the tasks and waits for them to complete,
- wakes up all sleeping threads,
- cancels sleep operations if any is being executed at the moment,
For the correct answer scroll down
.
.
.
.
.
.
The correct answer is: c. For more information read ExecutorService - how to complete a task by multiple threads in Java.