Question: The following class LinkedNode representing a node. If the variable list represents a linked list of these nodes, which of the statement that follows the
The following class LinkedNode representing a node. If the variable list represents a linked list of these nodes, which of the statement that follows the class definition will traverse that the data in the list? Class LinkedNode {int data; LinkedNode next; LinkedNode(int) {data = i; next = null;}} I public void print(LinkedNode list() {LinkedNode current = list; while (current next! = null) {System.out.println(current data); current = current.next;}} II public void print(LinkedNode list) {LinkedNode current = list; while (current! = null) {System.out.println(current next); {System.out.println(current.next); current = current.next;}} III public void print(LinkedNode list) {LinkedNode current = list; while (current! = null) {System.out.println(current.data); current = current.next;}} IV public void print(LinkedNode list) {LinkedNode current = list; while(current! = null) {System.out.println(current.data); current++;}}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
