public class ObjQueue<E> extends Vector<E>
{...}
ObjQueue<Customer>[] line=new ObjQueue[numServices];
...
if(line[waitingLine].isEmpty()) --emptyLines;
NullPointerException is for if(line[waitingLine].isEmpty()) --emptyLines; What’s wrong?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This:
creates an array with all of its elements set to
null— not an array of empty queues. So this:will invoke
isEmpty()onnull, unless you’ve explicitly initialized the elements oflinein some way.You probably want to follow this:
with this:
to initialize each element to a new, distinct queue.