I am using arraylist in my java program but the problem is that when i add an item in arraylist its adding on the same index so i want to know that how to increment array index in array list.
ArrayList arr = new ArrayList(500);
StringTokenizer st = new StringTokenizer(line, ":Mode set - Out of Service In Service");
while(st.hasMoreTokens()){
arr.add(st.nextToken());
}
In above code its keep adding item on the same index i.e. arr[0].
lineby":Mode set - Out of Service In Service"?