YogenGhodke
9/4/2019 - 5:54 AM

ArrayList

ArrayList<String> list=new ArrayList<String>();
            OR
ArrayList x = new ArrayList();

x.add("abc");

// Traversal 1

Iterator itr = x.iterator();  
  while(itr.hasNext())
      System.out.println(itr.next());  

// Traversal 2

for (int i=0; i<x.size(); i++)
    System.out.println( x.get(i) );

// Traversal 3
    
for (String z : x)
    System.out.println( z );