How to increment array index
<p>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.</p>

<pre><code>ArrayList arr = new ArrayList(500);
StringTokenizer st = new StringTokenizer(line, ":Mode set - Out of Service In Service");
while(st.hasMoreTokens()){
    arr.add(st.nextToken());
}
</code></pre>

<p>In above code its keep adding item on the same index i.e. arr[0].</p>
