import java.util.*;
public class LinkeListOper4 {
public static void main(String args[]) {
LinkedList<String> ll = new LinkedList<>();
ll.add("john");
ll.add("kiyan");
ll.add("kayna");
ll.add("cristy");
System.out.println("Before removing elements the list is : " + ll);
ll.remove(0); //remove function will take index of the element as parameter
ll.remove(1);
System.out.println("After removing elements the list is : " + ll);
//to remove all element from the list
ll.clear();
System.out.println("After removing elements the list is : " + ll);
}
}