Question: we have a linkList of ListNode { 1 , 2 , 3 } class ListNode { int data; ListNode next; } the first node is

we have a linkList of ListNode{1,2,3}
class ListNode
{
int data;
ListNode next;
}
the first node is n1, the second node is n2 and the third node is n3. Which one of the following will display 3 on the screen
1. System.out.println(n1.next.next.data);
2. System.out.println(n1.next.data)
3. System.out.println(n3.data)
4. System.out.println(n2.next.data);

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!