How do i add to an empty Array whilst in a loop?
I can't find any add function in the java api.
All I have really tried is array1.add(..);
Thanks.
Printable View
How do i add to an empty Array whilst in a loop?
I can't find any add function in the java api.
All I have really tried is array1.add(..);
Thanks.
That's not how arrays work. Recommended reading: Arrays (The Java™ Tutorials > Learning the Java Language > Language Basics)
(that's the first result for googling "java arrays" by the way, that's always a good place to start)
Okay thanks for your help!
If you need to add to arrays without a specified index you are able to use the vector method for a growing index.
What is a vector method?
Sorry I didn't see this when you posted. Thanks, i will look into the vector method!