What is the difference between ExecutorService.submit and ExecutorService.execute in this code in Java?

前端 未结 8 1331
你的背包
你的背包 2021-01-30 00:05

I am learning to use ExectorService to pool threads and send out tasks. I have a simple program below

import java.util.concurrent.Execu         


        
8条回答
  •  执笔经年
    2021-01-30 00:38

    Submit - Returns Future object, which can be used to check result of submitted task. Can be used to cancel or to check isDone etc.

    Execute - doesn't return anything.

提交回复
热议问题