Saturday, 28 September 2013

java.lang.NullPointerException in Queue

java.lang.NullPointerException in Queue

I have this error when i call the function enqueue to enqueue a stack into
a queue. This the code where the problem is:
ladder.push(start);
ladder.push(helpWord);
this.wordLadders.enqueue(ladder); <--Here is the problem(The code above is
given)
(start and helpWord are string)
where:
private Queue<Stack<String>> wordLadders;
and costractor is:
this.wordLadders = new Queue<Stack<String>>();
Also the function of enqueue is working using stacks, this the code where
A is a stack:
public void enqueue(AnyType value) {
A.push(value);
}
thank you!

No comments:

Post a Comment