这是我的代码。 请告诉我这里出了什么问题以及如何纠正它
public void displayList(){ //displays items on the list
Node current = head;
while(current!=null){
current = current.next;
System.out.println(current);
}
对于初学者来说,在 Node current = head;
中,除非它是预定义的字段,否则head
不存在。
字段有时不是偶然初始化的。当心这一点。