【发布时间】:2019-09-20 02:57:03
【问题描述】:
所以我创建了一个扩展Thread 类的class,并且我有一个调用start() 的主类。
我已经创建了 1000 个线程来以这种方式运行我的程序:
int ThreadNum = 1000;
for(int i=0; i<ThreadNum; i++){
Thread_Class function = new Thread_Class();// The Thread_Class is the one that extends the Thread class.
function.start(); }
这会产生 1000 个线程吗?以及如何从所有线程收集数据?
非常感谢!!我都很感激!
【问题讨论】:
-
是的,您正在创建
1000线程以及您想收集哪些数据? -
我让每个线程运行一个函数,该函数将产生一个双精度类型的数字,我想从所有这 1000 个线程中收集它们,并能够使用收集到的数据并做其他事情。
标签: java multithreading java-threads collect