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 && 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
Get step-by-step solutions from verified subject matter experts
