我想用几个Threads计算Words,每个线程都有一个“wordCount”变量。现在我怎么能等到每个线程都完成了?最后我应该计算每个线程的每个变量并将其打印出来?
我如何创建主题:
for (int i = 1; i <= THREADS_TO_USE; i++) {
long bytesToRead = splitManager();
new Thread(new CountWordsThread(file, bytesToRead, bytesCounted)).start();
}