public static void main(String[] args) {
ArrayList v1 = new ArrayList();
v1.add(123);
v1.add(153);
v1.add(125);
Enumeration en = v1.elements(); // This line gives error.
v1.add(4000);
while(en.hasMoreElements())
{
System.out.println(en.nextElement());
}
System.out.println(v1);
}
Why there is an error in case of ArrayList but not in case of Vector?