Question: public class ItemNode { private String item; private ItemNode nextNodeRef; / / Reference to the next node public ItemNode ( ) { item =
public class ItemNode
private String item;
private ItemNode nextNodeRef; Reference to the next node
public ItemNode
item ;
nextNodeRef null;
Constructor
public ItemNodeString itemInit
this.item itemInit;
this.nextNodeRef null;
Constructor
public ItemNodeString itemInit, ItemNode nextLoc
this.item itemInit;
this.nextNodeRef nextLoc;
Insert node after this node.
public void insertAfterItemNode nodeLoc
ItemNode tmpNext;
tmpNext this.nextNodeRef;
this.nextNodeRef nodeLoc;
nodeLoc.nextNodeRef tmpNext;
TODO: Define insertAtEnd method that inserts a node
to the end of the linked list
Get location pointed by nextNodeRef
public ItemNode getNext
return this.nextNodeRef;
public void printNodeData
System.out.printlnthisitem;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
