Difference between Callable and Runnable
Page 1 of 1
Difference between Callable and Runnable
Though both the interfaces are implemented by the classes who wish to execute in a different thread of execution, but there are few differences between the two interface which are:
A Callable instance returns a result of type V, whereas a Runnable instance doesn't
A Callable instance may throw checked exceptions, whereas a Runnable instance can't
The designers of Java felt a need of extending the capabilities of the Runnable interface, but they didn't want to affect the uses of the Runnable interface and probably that was the reason why they went for having a separate interface named Callable in Java 1.5 than changing the already existing Runnable
A Callable instance returns a result of type V, whereas a Runnable instance doesn't
A Callable instance may throw checked exceptions, whereas a Runnable instance can't
The designers of Java felt a need of extending the capabilities of the Runnable interface, but they didn't want to affect the uses of the Runnable interface and probably that was the reason why they went for having a separate interface named Callable in Java 1.5 than changing the already existing Runnable
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
|
|