method in java that takes a linked list with integer values and determines the largest value in the list and prints it
public class LinkedList { Node head; public void printLargest() { Node current = head; int max = head.data; while (current.next != null) { if (current.data > max) { max = current.data; } current = current.next; } System.out.println("max: " + max); } } LinkedList list = new LinkedList(); list.printLargest();