Question: X 9 7 4 : Create New Node Using this class definition: 1 public class node { 2 / / . . . instance variables

X974: Create New Node
Using this class definition:
1
public class node {
2
//... instance variables
3
public node(E d, node n){
4
this.data = d;
5
this.next = n;
6
}
7
public E getData(){return data; }
8
public void setData(E d){data = d; }
9
public node getNext(){return next; }
10
public void setNext(node n){next = n; }
11
}
Complete the method createNewNode that returns a new node using the constructor above.
Your Answer:
1
public node createNewNode(E a)
2
{

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!