X974: Create New Node

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; }
}

Complete the method createNewNode that returns a new Node using the constructor above.

Your Answer:

Feedback

Your feedback will appear here when you check your answer.