Hello , Could you please tell me how to do this. I want to have an array which is String in type which the size gets increased dynamically. Say if there are 10 items the array size is 10 . If there is only 1 item the array size is one. Like that initially with out specifying the size. Thanks
SCJP 1.4, SCMAD 1.0<br />SCWCD, SCBCD (in progress)
Joined: Aug 20, 2001
Probably the easiest way to do this is to use a java.util.List instead of an array. If you need to use an array, you just call .toArray() on the list to express it as an array. (Or .toArray(new SomeClass) to return an array that can be cast to a SomeClass )
Piscis Babelis est parvus, flavus, et hiridicus, et est probabiliter insolitissima raritas in toto mundo.
Joined: Aug 03, 2002
You cannot do it with a Java built-in array (the  kind). An approximation would be an ArrayList found in the java.util package. You could use ArrayList's trimToSize() method when you remove things from the end of the ArrayList.