Java中Callable接口(多线程实现的第三种办法)

实现多线程程序的步骤:    1)自定义类实现Callable接口,重写接口中的run方法(V call()throws Exception)其他两种方法run()没有返回值      2)建立线程池对象: Executors 里面的那个方法,返回的是ExecutorsService      3) 而后调用ExecutorsService里面的提交任务的方法:<T> Future<T> subm
相关文章
相关标签/搜索