On Sun, 02 Oct 2005 09:32:29 -0700, azzamqazi wrote:
> hi guys,
> i am having a problem and was thinking if someone can help me. ok
> here it goes. How do i append to the end of an array?? I mean if i
> have an array of strings how do i append a new string at the end of
> the array in another method. Thanks guys :)
There is no way to increase the size of an array. You have to create a
new array however big you need it and then copy the old array into it.
If this is really what you want to do, of course.
If you you are regularly doing this on large arrays you will end up with
a very poorly performing implementation. You should look at using a
LinkedList or ArrayList. These are implementations of the List
interface of the collections API. This is really what you probably
want.
> PS i think it might have to do something wit stacks but not sure :)
Hmm. Maybe in how you would implement one. Take a look at Stack too.
- --
Kenneth P. Turvey <kt-usenet@squeakydolphin.com>
http://kt.squeakydolphin.com (not much there yet)
Jabber IM: kpturvey@jabber.org
Phone: (314) 255-2199
> i am having a problem and was thinking if someone can help me. ok
>here it goes. How do i append to the end of an array?? I mean if i have
>an array of strings how do i append a new string at the end of the
>array in another method. Thanks guys :)
use an ArrayList
See http://mindprod.com/jgloss/arraylist.html

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.