+ 1

dynamic arrays

how to dynamically create arrays in java

16th Feb 2017, 1:51 AM
Vishnu Sivan
Vishnu Sivan - avatar
1 Antwort
+ 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