int arr[]={1,2,34,5,8,65};
Node link=new Node();
for(int i:arr){
Node x=new Node();
x.value=arr[i];
x.next=link;
link=x;
}
//头插
int arr[]={1,2,34,5,8,65};
Node link=new Node();
link.value=arr[0];
Node flag=link;
for(int i=1;i<arr.length;i++){
Node x=new Node();
x.value=arr[i];
flag.next=x;
flag=flag.next;
}
//尾插
public class Node {
public int value;
public Node next;
@Override
public String toString() {
return value +
"===>" + next
;
}
}