String Array - Dynamic allocation of values

i have one String array like this String strArr[]; initially i dont know how many elements i can store in it, so, can i store elements in it dynamically by increasing its size dynamically to accomodate the elements
[243 byte] By [AnjanReddya] at [2007-11-26 13:21:54]
# 1
a List would be more appropriate, you cannot dynamically change the size of an array, you can only create a new one and copy the old array.
gimbal2a at 2007-7-7 17:52:10 > top of Java-index,Java Essentials,New To Java...
# 2
Hi,You can use a vector to do that.Regards
Nosha at 2007-7-7 17:52:10 > top of Java-index,Java Essentials,New To Java...
# 3
Try ArrayList (a newer version of Vector) it does exactly what you want without having to bother handling the increases in size yourself.If you only iterate through the list and don't need random access a LinkedList may be more useful.
Strider80a at 2007-7-7 17:52:10 > top of Java-index,Java Essentials,New To Java...