What are two differences between Callable and Runnable?

What are two differences between Callable and Runnable?

What are two differences between Callable and Runnable?

A.
A Callable can return a value when executing, but a Runnable cannot.

B.
A Callable can be executed by a ExecutorService, but a Runnable cannot.

C.
A Callable can be passed to a Thread, but a Runnable cannot.

D.
A Callable can throw an Exception when executing, but a Runnable cannot.

Explanation:

The Callable interface is similar to Runnable, in that both are designed for classes whose
instances arepotentially executed by another thread. A Runnable, however, does not return a
result and cannot throw achecked exception.



Leave a Reply 1

Your email address will not be published. Required fields are marked *