What Is Difference Between Submit() And Execute() Method Of Executor And Executorservice In Java?
Answer»
execute() method is provided by EXECUTOR interface where as SUBMIT() method is provided by ExecutorService.
execute() method only takes Runnable as ARGUMENT - execute(Runnable command) and does not return any value.
ExecutorService has more versatile submit() method. submit() method is overloaded and accepts both Runnable objects and Callable objects, submit also allows the task to return a value (an object of type Future). The Future's get method will return the given result upon successful completion.