NullPointerException when thying to add an object to a PriorityQueue
Posted
by meagan
on Stack Overflow
See other posts from Stack Overflow
or by meagan
Published on 2010-04-27T04:15:17Z
Indexed on
2010/04/27
4:23 UTC
Read the original article
Hit count: 280
i keep getting a null pointer exception when trying to add an object to a priority queue
i initialize the queue:
private PriorityQueue<NodeObject> nodes;
and here i try to add to it:
NodeObject childNode = new NodeObject(child, 1);
nodes.add(childNode);
why doesn't this work? i know my NodeObject is not null because i create it right before i add it.
© Stack Overflow or respective owner