How can I dynamically add items to a Java array?

The Solution to How can I dynamically add items to a Java array? is


Look at java.util.LinkedList or java.util.ArrayList

List<Integer> x = new ArrayList<Integer>();
x.add(1);
x.add(2);

~ Answered on 2011-02-21 02:32:03


Most Viewed Questions: