NullPointerException试图调用具有正确返回类型的方法

时间:2013-04-28 01:49:41

标签: java nullpointerexception

为什么这行会给我一个NullPointerException?

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

getComments()方法确实返回了一个List,但是当我单步执行Eclipse中的代码时,该方法甚至不会被调用。

1 个答案:

答案 0 :(得分:5)

唯一可能是commentDAO为空