问题
I have this code
public class Doublylinkedlist {
private DLLNode head;
private DLLNode tail;
private int length;
}
What is this DLLNode
head declaration? What data type it is? Can someone please explain?
Here is the DLLNode class
Public class DLLNode{
private int data ;
private DLLNode prev;
private DLLNode next;
}
Now what is this 'private DLLNode prev'? What data type it is ?
回答1:
DLLNode is a user defined class just like your Doublylinkedlist class.
A possible example of what that DLLNode class might look like:
public class DLLNode
{
int data;
DLLNode next;
DLLNode prev;
public DLLNode(int data)
{
this.data = data;
this.next = null;
this.prev = null;
}
}
来源:https://stackoverflow.com/questions/35533868/cant-understand-java-doubly-linked-list