Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

LinkedList NullPointerException in LinkedList Class

$
0
0
How can the if statement in the following snippet of code throw a null pointer exception in my LinkedList class? Isn't it 'handled' per-say by the if statement?


if(iter.getNext() == null) {
			iter.setNext(new ListElement(data, null)); // set the new tail
			return head;
		}

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>