What is the difference between Callable and Runnable in Java?
Why Interviewers Ask This
This is a differentiating question used for senior and lead roles. Interviewers want to see if you can explain not just what happens, but why — and what the trade-offs are in different approaches.
Answer
Both Runnable and Callable represent tasks to be executed by a thread or executor, but they differ in two ways. Runnable has a run() method with no return value (void) and cannot throw checked exceptions. Callable<V> has a call() method that returns a value of type V and can throw checked exceptions. Callable is submitted to an ExecutorService via submit(), which returns a Future<V> that can be used to retrieve the result or check for exceptions. Runnable can be used with both Thread and ExecutorService. For tasks that need to return results or propagate checked exceptions, Callable with Future (or CompletableFuture) is the right choice.
Common Mistake
A common mistake is memorizing definitions without understanding implications. When asked this question, go one level deeper — explain what happens when this concept is misused or ignored.
Previous
What is a memory leak in Java and how do you prevent it?
Next
What are Java annotations and how do they work?