In [1]:
class Node {
    String data;
    Node next;
    
    Node(String data) {
        this.data = data;
    }
}
|  Added class Node

In [2]:
class SortedLinkedList {
    Node head;
    
    void insert(Node node) {
        // This is wrong... just inserts at front:
        node.next = head;
        head = node;
    }
    
    void print() {
        Node current = head;
        while (current != null) {
            printf("\"%s\", ", current.data);
            current = current.next;
        }
    }
    
    void delete(String search) {
        Node current = head;
        Node previous = null;
        while (current != null) {
            if (current.data == search) { // need to delete this one!
                if (previous == null) { // first one
                    head = current.next;
                } else {
                    previous.next = current.next;
                }
                break;
            }
            previous = current;
            current = current.next;
        }
    }
    
}
|  Added class SortedLinkedList

In [3]:
SortedLinkedList sll = new SortedLinkedList();
|  Added variable sll of type SortedLinkedList with initial value SortedLinkedList@4ca8195f

In [4]:
sll.insert(new Node("A. Ham"));

In [5]:
sll.print()
"A. Ham", 
In [6]:
sll.insert(new Node("A. Burr"));

In [7]:
sll.print();
"A. Burr", "A. Ham", 
In [8]:
sll.insert(new Node("Peggy Skylar"));

In [9]:
sll.print();
"Peggy Skylar", "A. Burr", "A. Ham", 
In [10]:
sll.delete("A. Burr");

In [11]:
sll.print();
"Peggy Skylar", "A. Ham", 
In [12]:
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
|  Added variable br of type BufferedReader with initial value java.io.BufferedReader@3ac42916