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

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

Want to excel in Java? Test your knowledge with our ultimate quiz based on 'Thinking in Java'. Engage with multiple-choice questions and in-depth explanations. Boost your understanding and prepare for your exam with confidence.

Each practice test/flash card set has 50 randomly selected questions from a bank of over 500. You'll get a new set of questions each time!

Practice this question and more.


What interface do you implement for a class to fulfill a task but not return any value?

  1. Callable

  2. Executors

  3. Runnable

  4. Thread

The correct answer is: Runnable

The correct interface to implement for a class to execute a task but not return a value is the Runnable interface. Option A, Callable, is incorrect because it is used when a value needs to be returned. Option B, Executors, is incorrect because it is a class that provides static utility methods for executing tasks. Option D, Thread, is incorrect because it is a class rather than an interface.