46. 线程池中 submit() 和 execute() 方法有什么区别?
46. What is the difference between submit() and execute() in a thread pool?
题目类型: 技术面试题
这是一道技术面试题,常见于澳洲IT公司面试中。
难度: easy
分类: Concurrency
标签: submit, execute
参考答案摘要
答案 execute():只能执行 Runnable 类型的任务。 submit():可以执行 Runnable 和 Callable 类型的任务。 Callable 类型的任务可以获取执行的返回值,而 Runnable 执行无返回值。
本题提供 STAR 原则详细解答和技术解析,登录匠人学院学习中心即可查看完整答案。