这是我的代码。我在构造函数的最后一行得到空指针异常(workerQueue[i] = new LinkedBlockingQueue(100);):
public class QueueThreadPool {
private BlockingQueue<String>[] workerQueue;
private Thread[] workerThreads;
private int numQueues;
private int numThreads;
public QueueThreadPool(int numThreads, int numQueues) {
this.numQueues = numQueues;
this.numThreads = numThreads;
for(int i=1; i<=numQueues; i++){
workerQueue[i] = new LinkedBlockingQueue<String>(100);
}
}
public static void main(String args[]){
System.out.println("Start...");
new QueueThreadPool(50, 11);
System.out.println("End...");
}
请帮忙!谢谢!!