Machine-translated by Google. Questions are authored in English.
Top

Discussion

Which of these is the correct type for the value a Future<?> from submit(Runnable) yields?

  • A.a Thread
  • B.a boolean reporting success
  • C.null, because the task produces no value
  • D.the Runnable itself

Answer: C

The one-argument submit for a Runnable gives a Future whose get returns null once the task is done, so the Future is useful for waiting and for surfacing an exception rather than for a result. A second argument can supply a fixed value to return instead.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.