Mastering Java: The Ultimate Quiz for 'Thinking in Java'

Disable ads (and more) with a membership for a one time $2.99 payment

Mastering Java: The Ultimate Quiz for 'Thinking in Java'. Dive deep into Java with multiple-choice questions. Challenge yourself with quiz questions designed to test and improve your understanding of the 'Thinking in Java' book. Get ready for your exam!

Practice this question and more.


What method is used to create a new thread in a thread pool using a ThreadFactory?

  1. create(ThreadFactory factory)

  2. newThread(Runnable r)

  3. build(ThreadFactory factory)

  4. generate(ThreadFactory factory)

The correct answer is: newThread(Runnable r)

A new thread in a thread pool is created using the newThread(Runnable r) method, which is specifically designed for this task. Other choices such as create, build, and generate do not have anything to do with creating threads in a thread pool, and may be methods used for other purposes. Therefore, B is the correct answer for this question.