Java examples for Collection Framework:LinkedList
First, you declare a LinkedList variable, and then you call one of the LinkedList constructors to create the object.
For example:
LinkedList officers = new LinkedList();
list that holds strings:
LinkedList<String> officers = new LinkedList<String>();
Then, you can only add String objects to this list.
import java.util.LinkedList; public class Main { public static void main(String[] args) { LinkedList officers = new LinkedList(); LinkedList<String> officers2 = new LinkedList<String>(); }/*from www. j av a 2s . c o m*/ }