Java examples for Collection Framework:LinkedList
Adding Items to a LinkedList with addLast method
import java.util.LinkedList; public class Main { public static void main(String[] args) { LinkedList<String> officers = new LinkedList<String>(); officers.addFirst("B"); officers.addFirst("M"); officers.addFirst("D"); officers.addFirst("P"); officers.addFirst("L"); for (String s : officers) System.out.println(s);//from w ww. j a v a2s. com } }