Java OCA OCP Practice Question 2284

Question

Which one of the following methods return a Future object?

  • A. the overloaded replace() methods declared in the ConcurrentMap interface
  • B. the newThread() method declared in the ThreadFactory interface
  • C. the overloaded submit() methods declared in the ExecutorService interface
  • D. the call() method declared in the Callable interface


C.

Note

option a) the overloaded replace() methods declared in the ConcurrentMap interface remove an element from the map and return the success status or the removed value.

option B) the newThread() is the only method declared in the ThreadFactory interface and it returns a Thread object as the return value.

option C) the ExecutorService interface has overloaded submit() method that takes a task for execution and returns a Future representing the pending results of the task.

option D) the call() method declared in Callable interface returns the result of the task it executed.




PreviousNext

Related