NullPointerException: Palindrome using Stack and Queue

I'm working on an assignment where I use the StackList and QueueList classes that I've created to check for a words that are palindromes. The idea is to read from a file and take the characters from each word and:

push each character off the word onto a stack. enqueue each character of the word onto the queue. While there are still elements in the queue/stack - if the first character popped form the stack equals the first character dequeued from the queue, continue, else return false. If the while loop finishes, return true.

I'm assuming and hoping my StackList and QueueList classes are implemented properly. Anyways, each time I try to run the program I catch a null pointer exception, any ideas on as to why?

http://pastebin.com/4FGS1fpg

edit: I did a bit of debugging and it seems to reach the isPalindrome() method and immediately catch a nullpointerexception from there.

Posted Feb 21, 2016, 9:28 PM UTC · edited

36
Loading comments…