Simple Example of LinkedList in Java .

Simple Example of LinkedList in Java .

import java.util.*;

class Test1{

public static void main(String args[])  {

LinkedList al=new LinkedList();

al.add("HELLO");

al.add("MY");

al.add("JAVA");

al.add("COLLECTION");

Iterator itr=al.iterator();

while(itr.hasNext()){

System.out.println(itr.next());

} } }

Output: HELLO
               MY
               JAVA
               COLLECTION

Read More →