user636859
user636859

Reputation:

NullPointerException trying to call a method with correct return type

Why would this line give me a NullPointerException?

List<Comment> commentList = commentDAO.getComments();

The getComments() method does indeed return a List, but when I step through the code in Eclipse, the method doesn't even get called.

Upvotes: 0

Views: 37

Answers (1)

Lucas
Lucas

Reputation: 14979

The only possibility is that commentDAO is null

Upvotes: 5

Related Questions