Callable Vs Runnable interface in Java multithreading?

(Last Updated On: April 9, 2017)

Callable Vs Runnable interface in Java Multithreading.

  • A Callable can return a result but a Runnable interface cannot.
  • A Callable can throw checked exception but a Runnable cannot.
  • Callable provides call() method to implement and Runnable interface provides run() method to implement in java.

Here is the example how callable and runnable interface look like.

Runnable interface in Java:
Callable Interface in Java:
 

NOTES:

Callable interface is just a better design of runnable interface in java and introduced in JDK-1.5. Runnable interface has been around 1.0. So, callable interface is filled with features that runnable interface does not support. Though Callable support all the feature that Runnable support, Runnable interface in java is still there for backward compatibility.

 

Callable Interface and Runnable Interface provided in java doc:
Callable:

Runnable:

public interface  Runnable {

When an object implementing interface Runnable is used to create a thread, starting the thread causes the object’s run method to be called in that separately executing thread.

The general contract of the method run is that it may take any action whatsoever.

See also:
Thread.run()

public abstract void run();

}