execute和submit的主要区别是什么?
- 内容介绍
- 文章标签
- 相关推荐
本文共计840个文字,预计阅读时间需要4分钟。
1. `execute` 方法在 `java.util.concurrent.Executor` 中的定义:`void execute(Runnable command);`
2.`execute` 方法的具体实现:`public void execute(Runnable command) { if (command==null) throw new NullPointerException(); /* ... */ }`
3.实现步骤:抛出 `NullPointerException`,如果 `command` 为 `null`。
本文共计840个文字,预计阅读时间需要4分钟。
1. `execute` 方法在 `java.util.concurrent.Executor` 中的定义:`void execute(Runnable command);`
2.`execute` 方法的具体实现:`public void execute(Runnable command) { if (command==null) throw new NullPointerException(); /* ... */ }`
3.实现步骤:抛出 `NullPointerException`,如果 `command` 为 `null`。

