java多线程问题,大神帮我解释解释下面这几句话的意思?

2025-01-06 02:51:48
推荐回答(2个)
回答1:

Thread threads[] = new Thread[100];是一个数组,下面的代码写错了,应该都是threads[i]调用数组中的线程类对象才对,现在的代码运行肯定报错的

回答2:

threads = new JoinThread();
threads.start();
threads.join();
改为:
threads[i] = new JoinThread();
threads[i].start();
threads[i].join();