Difference between Callable and Runnable

Go down

Difference between Callable and Runnable Empty Difference between Callable and Runnable

Post  Admin on Fri Oct 14, 2011 10:16 pm

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


Posts : 131
Join date : 2011-08-16

View user profile http://codefornongeek.forumotion.com

Back to top Go down

Back to top

Permissions in this forum:
You cannot reply to topics in this forum