1Z0-805 · Question #48
Which three must be used when using the Java.util.concurrent package to execute a task that returns a result without blocking?
The correct answer is A. ExecutorService D. Callable F. Executor. The java.util.concurrent package defines three executor interfaces: (F)Executor, a simple interface that supports launching new tasks. (A)ExecutorService, a subinterface of Executor, which adds features that help manage the lifecycle, both of the individual tasks and of the…
Question
Which three must be used when using the Java.util.concurrent package to execute a task that returns a result without blocking?
Options
- AExecutorService
- BRunnable
- CFuture
- DCallable
- EThread
- FExecutor
How the community answered
(28 responses)- A79% (22)
- B4% (1)
- C14% (4)
- E4% (1)
Explanation
The java.util.concurrent package defines three executor interfaces: *(F)Executor, a simple interface that supports launching new tasks. *(A)ExecutorService, a subinterface of Executor, which adds features that help manage the lifecycle, both of the individual tasks and of the executor itself. * ScheduledExecutorService, a subinterface of ExecutorService, supports future and/or periodic execution of tasks. Typically, variables that refer to executor objects are declared as one of these three interface types, not with an executor class type. D: The ExecutorService interface supplements execute with a similar, but more versatile submit Oracle 1Z0-805 Exam method. Like execute, submit accepts Runnable objects, but also accepts Callable objects, which allow the task to return a value.
Topics
Community Discussion
No community discussion yet for this question.