Question: java For each numbered line below, write: 1. the contents of the chain of nodes headed by firstNode 2. the value of the data in
java
For each numbered line below, write:
1. the contents of the chain of nodes headed by firstNode
2. the value of the data in the node current.
Use the simple method of writing a chain where you list only the data, such as 123.
Noden0 = new Node ("y"); Node n1 = new Node ("k", n0); Node n2 = new Node ("c", n1); Node n3 = new Node ("i", n2); Node n4 = new Node ("p", n3); Node firstNode = n4; // line 1 Node current = firstNode; // line 2 current = current.next; // line 3 firstNode = firstNode.next; // line 4 current.next.data = "n"; // line 5 current.next = current.next.next.next; // line 6 firstNode.data = "b"; // line 7 current = current.next; // line 8 firstNode.next = current.next; // line 9
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
