What is Callable interface in Java?

Java 8Object Oriented ProgrammingProgramming

The Callable interface is found in the package java.util.concurrent. The Callable object can return the computed result done by a thread in contrast to a runnable interface which can only run the thread. The Callable object returns a Future object which provides methods to monitor the progress of a task being executed by a thread. The future object can be used to check the status of a Callable and then retrieve the result from the Callable once the thread is done. It also provides timeout functionality.

Published on 02-Jan-2018 11:09:28