Friday, 19 March 2021

ArrayList in Java

 import java.util.*;

class CL1

{

public static void main(String[] args)

{

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

A1.add("Ram");

A1.add("Raj");

A1.add("Raman");

A1.add("Rajan");

Iterator itr=A1.iterator();

while(itr.hasNext())

{

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

}

}

}

No comments:

Post a Comment