importjava.util.LinkedList;publicclassRemoveExample{publicstaticvoidmain(String[] args){// Create a LinkedListLinkedList<String> linkedlist =newLinkedList<String>();// Add elements to LinkedList
linkedlist.add("Item1");
linkedlist.add("Item2");
linkedlist.add("Item3");
linkedlist.add("Item4");
linkedlist.add("Item5");// Displaying Elements before removeSystem.out.println("Before Remove:");for(String str: linkedlist){System.out.println(str);}// Removing "Item4" from the list
linkedlist.remove("Item4");// LinkedList elements after removeSystem.out.println("\nAfter Remove:");for(String str2: linkedlist){System.out.println(str2);}}}