valfield holding an Object and the
nextfield holding a reference to another Node.
Node head = null; for (int i=0; i<5; i++) head = new Node(i+"", head); Node temp = head; while (temp.val < "3") temp = temp.next; temp.next = new Node("new", temp.next);
i+""instead of just
headpoints to the beginning of a singly linked list, and that the nodes hold Objects. Write code that copies the elements of the list into an array by doing the following:
headpoints to the beginning of a singly linked list. Write code to remove the last item from the list and put it on the front of the list.