dynamic arrays | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

dynamic arrays

how to dynamically create arrays in java

16th Feb 2017, 1:51 AM
Vishnu Sivan
Vishnu Sivan - avatar
1 Answer
+ 2
By default arrays in Java are of fixed size. To create dynamic, you can use an ArrayList, one of a number Collections available in in the standard Java library. Example: List<Integer> ints = new ArrayList<Integer>(); will create a dynamic array of integers where, ints.add(y) and ints.remove(z) methods can be used to add and remove items from the array. Do consult Java documentation for further information on collections.
16th Feb 2017, 6:39 AM
เคฆเฅ‡เคตเฅ‡เค‚เคฆเฅเคฐ เคฎเคนเคพเคœเคจ (Devender)
เคฆเฅ‡เคตเฅ‡เค‚เคฆเฅเคฐ เคฎเคนเคพเคœเคจ (Devender) - avatar