Category: Threads

Sometimes we have to run a long-running task in a separate thread and return the result once execution is complete. Using Java Runnable interface we can run a task, but the disadvantage is it does not return result once execution is complete.

Then how can we achieve this?

There are two interfaces available in java.util.concurrent package using them we can solve this problem.