import java.util.LinkedList; public class LinkedListExample { public static void main(String[] args) { LinkedListlinkedList = new LinkedList<>(); linkedList.add("Apple"); linkedList.add("Banana"); linkedList.add("Cherry"); // Print the linked list System.out.println(linkedList.toString()); } }
[Apple, Banana, Cherry]The package library of LinkedList class is java.util.