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

Discussion

Which of these creates an executor backed by exactly one thread?

  • A.new ThreadPoolExecutor(1)
  • B.Executors.newSingleThreadExecutor()
  • C.Executors.newFixedThreadPool()
  • D.Executors.newCachedThreadPool(1)

Answer: B

newSingleThreadExecutor takes no arguments and gives a one-thread service. newFixedThreadPool requires a count, newCachedThreadPool takes none and grows on demand, and ThreadPoolExecutor's constructors need several arguments rather than one.

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

Post your comment

Please log in or register to post a comment.