Vector
import java.util.Iterator;
import java.util.Vector;
public class VectorDemo
{
public static void main(String[] args)
{
Vector list=new Vector();
for (int i = 0; i < 5; i++)
{
list.add(i); // adds elements to the vector
}
Iterator i = list.iterator(); // Iterators provide a standard way to loop through all items in a collection, regardless of the type of collection
while (i.hasNext())
System.out.println(i.next());
}
}
Output:
0
1
2
3
4