Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

array
java
communitycreator

How to append to an array in Java

Andreas Lundblad

In Java, arrays can’t grow once they have been created; so, to add an element, you need to:

  1. Create a new, larger array.

  2. Copy over the content of the original array.

  3. Insert the new element at the end.