Question: Node -item:int -next: Node +Node(newitem:int) +Node(newitem:int, nextNode: Node) +setitem(newitem:int): void *setNext(nextNode: Node): void +getitem(): Int getNext(): Node 18. (10 points) Node class. For the Node
Node -item:int -next: Node +Node(newitem:int) +Node(newitem:int, nextNode: Node) +setitem(newitem:int): void *setNext(nextNode: Node): void +getitem(): Int getNext(): Node 18. (10 points) Node class. For the Node class shown below, please correct the statement(s), if you find there are any syntactic or logical errors. (Hint: Refer to the UML shown above.) public class Node private Node item private Object next; (2) public void Node(Node newItem) { (3) next null; item - newItem: // end constructor (5) public void Node(int newitem, Node nextNode) (6) next = nextNode (7) item = newItem (8) end constructor public Node setItem(Object newItem) : 0) newitem = item; llend settem (10) public void setNext(Node nextNode) (11) nextNode = next Mend setNext (12) (13) public int getItem() { return next; // end getItem public void getNext() { (14) (15) return item; Wend getNet Wend class Node (16)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
