Java SE 8 Programmer II — Question 125
Which two statements are true about the Fork/Join Framework? (Choose two.)
Answer options
- A. The RecursiveTask subclass is used when a task does not need to return a result.
- B. The Fork/Join framework can help you take advantage of multicore hardware.
- C. The Fork/Join framework implements a work-stealing algorithm.
- D. The Fork/Join solution when run on multicore hardware always performs faster than standard sequential solution.
Correct answer: A, C
Explanation
Option A is correct because the RecursiveTask is specifically designed for tasks that return results, while RecursiveAction is used for those that do not. Option C is correct as the Fork/Join framework indeed uses a work-stealing algorithm to efficiently balance workloads across threads. Options B and D are misleading; while the framework can utilize multicore hardware, it does not guarantee performance will always be better than sequential solutions.