0
/ 10
Using this class definition:
public class node<E> { //... instance variables public node(E d, node<E> n) { this.data = d;...
Using this class definition:
public class node<E> {
//... instance variables
public node(E d, node<E> n) {
this.data = d;
this.next = n;
}
public E getData() {return data; }
public void setData(E d) {data = d; }
public node<E> getNext() {return next; }
public void setNext(node<E> n) {next = n; }
}
As a more general form of building nodes, this
method takes an array of values and creates
as many nodes as there are objects in the
values
array. This method returns the node
that has the values[0]
. The head node next
points to values[1]
, and so forth.
Your feedback will appear here when you check your answer.