Q42: What are the differences between Runnable and Callable interfaces?
Runnable:public void run(). Cannot return a result value; cannot throw checked exceptions.Callable<V>:public V call() throws Exception. Returns a generic resultV; allowed to throw checked exceptions. Used withExecutorServiceandFuture.
Key Takeaways
Runnable: Returnsvoid, handles no checked exceptions.Callable: Returns generic valueV, throws checked exceptions.
Knowledge Check
Which interface should be used for background asynchronous tasks that MUST return a calculation result?