Question: 1. (10 points) Correct the code for the Node class shown below, if there are ar logical errors. (Hint: Refer to the UML shown above.)
1. (10 points) Correct the code for the Node class shown below, if there are ar logical errors. (Hint: Refer to the UML shown above.) Pablic class Node private Node item; (1) private object item; private Object next; (2) Pnvate Node next. public void Node(Node newltem) I (3) item=newhem:(4). next=null: 1./Iend constractor public void Node(Object newltem, Node nextNode) t(6) next = nextNods; (7) item=newliem. Y. Jend constaictor public Node settem(Object newltem) {(9) newhem = item: I //end setitem public void setNext(Node nextNode) ((11) nexiNode = next: 1 / /end setNerl public Object getitem() I (13) return next: (i4) i//end gerilem public void getNext() f (15) retuns item: (16)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
