I am trying to load the list with index no..(I am using eclipse)
public static void main(
String[] args) {
int i;
List list = new ArrayList(20);
for(i=1;i<10;i++ ){
list.add(i, new Integer(i));
System.out.println("values at index " + i +" " + list.get(i) );
}
this is throwing error like --
Exception in
thread "main" java.lang.IndexOutOfBoundsException:
Index: 1,Size: 0
at java.util.ArrayList.add(Unknown Source)
can anybody help