Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.Start your free trial
Ryan Boyd7,561 Points
Adding to an array in Java
Java definitely expects its arrays to have a very low overhead in the amount of resources that they use, so unfortunately once an array is created we can't add items if it's already reached the capacity we created it with, unless we do as you said and create another array.
A way around this is what is called an Array List which is covered in the most recent Java Course.
It looks something like List<String> = new ArrayList<>();
In an array list you can add items to it and remove items from your list, like you would see with arrays in other programming languages.
The draw back is that it takes more resources.
Thanks hope this helps, shout at me if it doesn't.