guys, I'm trying to implement an "addLast" method of a LinkedList; however, I'm getting an endless loop.... could anyone help
public void addLast(int n) { Node p = new Node(n); if(first == null) { p.next = first; first = p; } else { Node current = first; while(current != null) { System.out.println("here!"); if(current.next == null) { current.next = p; } current = current.next; } } }