Simple Example of ArrayList in Java .

Simple Example of ArrayList in Java .

import java.util.*;

class Test{

public static void main(String args[])  {

ArrayList al=new ArrayList();

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 →