1、java线程池中的submit()和execute()方法有啥什么不同
两个方法都是将线程提交到线程池
(1)传入的参数不同
(2)execute没有返回值。submit返回Future对象
(3)excute方法会抛出异常。
sumbit方法不会抛出异常。除非你调用Future.get()。
(4)submit在interface ExecutorService内,execute在 interface Executor 中。
线程池中execute方法和submit方法的区别
线程池中execute方法和submit方法的区别

相关文章:

  • 2021-07-01
  • 2021-08-11
  • 2022-12-23
  • 2023-02-01
  • 2021-09-23
  • 2021-08-17
  • 2021-06-07
  • 2021-06-28
猜你喜欢
  • 2021-08-13
  • 2021-08-21
  • 2021-06-29
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案