import java.util.LinkedList; public class LinkedListExample { public static void main(String[] args) { LinkedListlinkedList = new LinkedList<>(); linkedList.add("Java"); linkedList.add("Python"); linkedList.add("Ruby"); String head = linkedList.peekFirst(); System.out.println("Head of the linked list: " + head); } }
Head of the linked list: JavaPackage Library: java.util