How many Threads are created when passing task to an Executor instance?
A.
A new Thread is used for each task.
B.
A number of Threads equal to the number of CPUs Is used to execute tasks.
C.
A single Thread Is used to execute all tasks.
D.
A developer-defined number of Threads is used to execute tasks.
E.
A number of Threads determined by system load is used to execute tasks.
F.
The method used to obtain the Executor determines how many Threads are used to execute tasks.
Explanation:
The Executor interface provides a single method, execute, designed to be a drop-in replacement for a common thread-creation idiom. If r is a Runnable object, and e is an Executor object you can replace (new Thread(r)).start(); with e.execute(r);
However, the definition of execute is less specific. The low-level idiom creates a new thread and launches it immediately. Depending on the Executor implementation, execute may do the same thing, but is more likely to use an existing worker thread to run r, or to place r in a queue to wait for a worker thread to become available.Reference: The Java Tutorial,The Executor Interface
F