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

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

Prepare for your Java exam with our ultimate quiz based on 'Thinking in Java'. Engage with expertly crafted questions that enhance your learning process. Perfect for Java enthusiasts looking to solidify their knowledge!

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 must be implemented for a class to execute a task that returns a result after completion?

  1. Runnable

  2. Callable

  3. Executor

  4. Futures

The correct answer is: Callable

A and C are incorrect because they do not return a result after completion. A Runnable does not return a value and an Executor is used to manage and execute threads, not tasks that return a result. D is not the best answer because Futures alone cannot implement a task, it is a mechanism for asynchronously retrieving results from a concurrent task. Callable is the closest match to what the question is asking for.