giovedì 7 novembre 2013

Q42

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.

 

La risposta è A e D.
Infatti sebbene Runnable e Callable siano simili Runnable non restituisce un risultato e non può throware una checked exception.

Riferimenti:

Nessun commento:

Posta un commento