What is the difference between Java Callable interface and Runnable interface?

Answer

The Callable interface and Runnable interface both are used by the classes which wanted to execute with multiple threads. However, there are two main differences between the both :

  • A Callable <V> interface can return a result, whereas the Runnable interface cannot return any result.
  • A Callable <V> interface can throw a checked exception, whereas the Runnable interface cannot throw checked exception.
  • A Callable <V> interface cannot be used before the Java 5 whereas the Runnable interface can be used.

All concurrency Questions

Ask your interview questions on concurrency

Write Your comment or Questions if you want the answers on concurrency from concurrency Experts
Name* :
Email Id* :
Mob no* :
Question
Or
Comment* :
 





Disclimer: PCDS.CO.IN not responsible for any content, information, data or any feature of website. If you are using this website then its your own responsibility to understand the content of the website

--------- Tutorials ---