Question: What is true of the following method? public void method(Node firstNode) { while(firstNode != null) System.out.println(firstNode.data); firstNode = firstNode.next; } it will crash on an

 What is true of the following method? public void method(Node firstNode)

What is true of the following method? public void method(Node firstNode) \{ while(firstNode != null) System.out.println(firstNode.data); firstNode = firstNode.next; \} it will crash on an empty list and singleton list. it will crash on an empty list but not on a singleton list none of these is correct there will be an infinite loop Question 25 2 pts What is true of the following method? public void method(Node firstNode) \{ Node secondNode = firstNode.next; Node currentNode = secondNode; while(currentNode != null) \{ System.out.println(currentNode. data); currentNode = currentNode.next; \} none of these is correct there will be an infinite loop it will crash on an empty list but not on a singleton list it will crash on an empty list and a singleton list

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!