创建单链表
public class aaa {
public static void main(String[] args) {
Node node = new Node(0);
Node node1 = new Node(1);
Node node2 = new Node(2);
node.next = node1;
node1.next = node2;
Node head = node;
while (head!=null){
System.out.println(head.value);
head=head.next;
}
}
}
class Node{
public int value;
public Node next;
public Node(int value){
this.value = value;
next = null;
}
}