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

Discussion

Which of these correctly submits work that returns no result?

  • A.es.submit(new Runnable() { public void run() { } });
  • B.es.submit(new Runnable() { public void run() { } }, void.class);
  • C.es.run(new Runnable() { public void run() { } });
  • D.es.start(new Runnable() { public void run() { } });

Answer: A

ExecutorService accepts a Runnable through submit, returning a Future of Object that completes with null, and through execute, which returns nothing. There is no run or start method on the interface; those belong to Runnable and Thread.

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

Post your comment

Please log in or register to post a comment.