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