runnable

The difference between Runnable and Callable in java

Preface In java’s multi-threaded development Runnable has always been the core of multi-threading, and Callable is an enhanced version of java 1.5 added in. In this article, we will explore the differences between Runnable and Callable in detail. Operation mechanism First look at the interface definition of Runnable and Callable: @FunctionalInterface public interface Runnable { /** * When an object implementing interface <code>Runnable</code> is used * to create a thread, starting the thread causes the object's * <code>run</code> method to be called in that separately executing * thread.