Question: public static void display2ndNode (Node top) { if(top != null && top.getLink() != null) { } } Which of the following statements should be added

 public static void display2ndNode (Node top) { if(top != null &&

public static void display2ndNode (Node top) { if(top != null && top.getLink() != null) { } } Which of the following statements should be added to the if statement above to display the data value stored in the 2nd node in the LinkedList beginning with the Node top. Assume that the Node class has a getData() accessor method. System.out.println(top.getLink()); None of these statements will work for all lists. System.out.println(top.getLink().getData()); More than one of these statements will work. System.out.println(top.getData())

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 Databases Questions!