先分别看看源码:
@FunctionalInterface public interface Runnable { /** * 被线程执行,没有返回值也无法抛出异常 */ public abstract void run(); } @FunctionalInterface public interface Callable<V> { /** * 计算结果,或在无法这样做时抛出异常。 * @return 计算得出的结果 * @throws 如果无法计算结果,则抛出异常 */ V call() throws Exception; }
- Runnable没有返回值并且无法抛出异常
- 不巧,我Callable可以做到你不能做到的
- Callable只能通过线程池执行。