Friday, May 13, 2016

java arraylist

package com.home;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;



public class ArrayLIstDemo {


public static void main(String[] args) {

ArrayList<String> alist = new ArrayList<String>();

alist.add("ram");
alist.add("hari");
alist.add("gopal");
alist.add("barma");




Iterator it = alist.iterator();
while(it.hasNext()){
System.out.println(it.next());

}





}
}

The Output Of the above program is:
ram
hari
gopal
barma

0 comments:

Post a Comment