VOOZH about

URL: https://www.geeksforgeeks.org/java/difference-between-callable-and-runnable-in-java/

⇱ Difference Between Callable and Runnable in Java - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Difference Between Callable and Runnable in Java

Last Updated : 23 Jul, 2025

java.lang.Runnable is an interface that is to be implemented by a class whose instances are intended to be executed by a thread. There are two ways to start a new Thread – Subclass Thread and implement Runnable. There is no need of sub-classing Thread when a task can be done by overriding only run() method of Runnable.

Callable interface and Runnable interface are used to encapsulate tasks supposed to be executed by another thread.

However, Runnable instances can be run by Thread class as well as ExecutorService but Callable instances can only be executed via ExecutorService.

Let us discuss differences between the two above interfaces as defined by discussing them individually later on concluding to major differences in a tabular format.

Callable Interface 

In a callable interface that basically throws a checked exception and returns some results. This is one of the major differences between the upcoming Runnable interface where no value is being returned. In this interface, it simply computes a result else throws an exception if unable to do so.

public interface Callable<V> 
{
 V call() throws exception ;
}
  1. It is declared in the 'java.util.concurrent' package.
  2. This interface also contains a single, no-argument method, called call() method
  3. We can’t create a thread by passing callable as a parameter.
  4. Callable can return results. Callable's call() method contains the “throws Exception” clause, so we can easily propagate checked exceptions further.

Example:

Output:

Hello World

Runnable interface 

When an object implementing this interface is used to create a thread, starting the thread causes the object run method to be called in a separately executing thread. The general. contract of this run() method is that it may take any action whatsoever. 

public interface Runnable 
{
 public abstract void run();
}
  • java.lang.Runnable is an interface and defines only one method called run(). 
  • It represents a task in Java that is executed by Thread.
  • There are two ways to start a new thread using Runnable, one is by implementing the Runnable interface and another one is by subclassing the Thread class.
  • Runnable cannot return the result of computation which is essential if you are performing some computing task in another thread, and Runnable cannot throw checked exceptions.

Example

Runnable interface Callable interface
It is a part of java.lang package since Java 1.0It is a part of the java.util.concurrentpackage since Java 1.5.
It cannot return the result of computation.It can return the result of the parallel processing of a task.
It cannot throw a checked Exception.It can throw a checked Exception.
In a runnable interface, one needs to override the run() method in Java.In order to use Callable, you need to override the call()
Comment