Did you try debugging your program?
If you don't know debugging, place print statements to find the value of your queue(list) at different locations.
Type: Posts; User: Mr.777
Did you try debugging your program?
If you don't know debugging, place print statements to find the value of your queue(list) at different locations.
int numShares = StockList.peek().getShares();
Most probably, this StockList.peek() is returning a null and you want a null to call getShares(). That is actually the problem. Good Luck