import java.util.*;
class
test {
public static void main(
String args[]) {
List list=new ArrayList(5);
list.add(1,new Integer(1));
list.add(2,new Integer(2));
list.add(3,new Integer(3));
Object o=(Integer)list.get(0);
System.out.println(o);
}
}
Why it compiles error saying java.lang.IndexOutOfBoundsException?
I know List are something like array but
when array are initialized,it will be automatically given a default value.
Then,what about the subclasses of List Interface.