Which three must be used when using the Java.util.concurrent package to execute a task that returns a result without blocking?

Which three must be used when using the Java.util.concurrent package to execute a task that
returns a result without blocking?

Which three must be used when using the Java.util.concurrent package to execute a task that
returns a result without blocking?

A.
ExecutorService

B.
Runnable

C.
Future

D.
Callable

E.
Thread

F.
Executor

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 method. Like execute, submit accepts Runnable objects, but also
accepts Callable objects, which allow the task to return a value.
Reference: The Java Tutorials,Executor Interfaces



Leave a Reply 1

Your email address will not be published. Required fields are marked *


zzZZzzzzZZzzz

zzZZzzzzZZzzz

A,C,D