能否请您描述它的使用下面的代码和它是如何工作。是否有必要使用静态嵌套类来创建一个节点链表
class LinkedList
{
Node head; // head of list
static class Node {
int data;
Node next;
Node(int d) { data = d; next=null; } // Constructor
}
public static void main(String[] args)
{
LinkedList llist = new LinkedList();
llist.head = new Node(1);
Node second = new Node(2);
Node third = new Node(3);
llist.head.next = second; // Link first node with the second node
second.next = third; // Link second node with the third node
}
}
不一定 – JavaHopper