Java
Runnable
Callable
Concurrency
Multithreading

The difference between the Runnable and Callable interfaces in Java

Interview Questions practice on Codemia

Over 8,000 real interview questions from top companies, searchable by company and role.

Browse interview questions

Introduction

Runnable and Callable both represent units of work that can run concurrently, but they are designed for different needs. Runnable is the older, simpler option for tasks that do not return a result, while Callable is the better fit when the task needs to return a value or throw checked exceptions.

Runnable In One Sentence

A Runnable has one method:

java
void run()

It does not return anything and cannot declare checked exceptions.

java
1public class Demo {
2    public static void main(String[] args) {
3        Runnable task = () -> System.out.println("Running in a thread");
4        Thread thread = new Thread(task);
5        thread.start();
6    }
7}

This is useful for fire-and-forget work or tasks where the result is communicated in some other way.

Callable In One Sentence

A Callable<V> has one method:

java
V call() throws Exception

It returns a value of type V and may throw checked exceptions.

java
1import java.util.concurrent.*;
2
3public class Demo {
4    public static void main(String[] args) throws Exception {
5        ExecutorService executor = Executors.newSingleThreadExecutor();
6
7        Callable<Integer> task = () -> 42;
8        Future<Integer> future = executor.submit(task);
9
10        System.out.println(future.get());
11        executor.shutdown();
12    }
13}

This is the usual choice when the caller needs to retrieve a computed result.

The Most Important Differences

The practical differences are:

  • 'Runnable returns nothing, Callable returns a value'
  • 'Runnable cannot declare checked exceptions, Callable can'
  • 'Runnable is commonly used with Thread directly'
  • 'Callable is typically submitted to an ExecutorService'

That last point matters because Callable works naturally with Future, which lets you inspect task completion and retrieve results.

When To Use Each One

Use Runnable when:

  • the task performs side effects only
  • no result needs to be returned
  • you want a simple command object

Use Callable when:

  • the task computes a value
  • failure needs to propagate as a checked exception
  • you want to coordinate with Future or executor APIs

If the task’s outcome matters, Callable is usually the better design.

Can A Runnable Still Produce Results

Yes, but only indirectly. A Runnable can mutate shared state, complete a promise-like object, or write into a queue. That works, but it is usually less explicit than a Callable returning a value.

java
Runnable task = () -> cache.put("answer", 42);

This is valid, but the result is communicated through external state rather than the task interface itself.

Executors Make The Difference Clearer

Modern Java concurrency usually relies on executors rather than raw Thread creation.

java
1import java.util.concurrent.*;
2
3ExecutorService executor = Executors.newFixedThreadPool(2);
4executor.submit((Runnable) () -> System.out.println("side effect"));
5Future<String> future = executor.submit(() -> "done");
6System.out.println(future.get());
7executor.shutdown();

Both interfaces can be submitted, but only the Callable task naturally returns a typed result.

Common Pitfalls

The most common mistake is using Runnable for a task that clearly has a meaningful result. That usually forces awkward shared-state patterns later.

Another mistake is forgetting that Future.get() can block. Using Callable gives you a result, but you still need to think about how and when you wait for it.

A third issue is assuming Callable is always superior. If the task truly has no result, Runnable keeps the API simpler and more honest.

Summary

  • 'Runnable is for concurrent work with no direct return value.'
  • 'Callable is for concurrent work that returns a result or throws checked exceptions.'
  • 'Runnable fits simple side-effect tasks well.'
  • 'Callable fits executor-based result retrieval through Future.'
  • Choose the interface based on whether the task’s outcome matters to the caller.

Related reading
Course
Intermediate
27 lessons
14 hours
OOD Fundamentals

Master object-oriented design from first principles, SOLID, design patterns, and classic interview problems with hands-on coding.

View the course
Track what you have practised

A free account saves your progress, solutions and study plan across every problem on Codemia.

Interview Questions practice on Codemia

Over 8,000 real interview questions from top companies, searchable by company and role.

Browse interview questions

All Rights Reserved.