Which method is used to submit a task for execution to the ExecutorService and returns a Future object?

  • addTaskToExecutor(Runnable task)
  • execute(Runnable task)
  • startTask(Callable task)
  • submit(Runnable task)
The submit(Runnable task) method of the ExecutorService interface is used to submit a task for execution and returns a Future object. This Future can be used to monitor the progress and retrieve the result of the task asynchronously. The other options are not correct methods for submitting tasks to an ExecutorService.
Add your answer
Loading...

Leave a comment

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