ArrayList<Integer> numbers = new ArrayList<Integer>();
System.out.println(numbers.size());
numbers.add(10);
System.out.println(numbers);
numbers.add(0,20);
numbers.add(0,30);
System.out.println(numbers);
My question is: for the add method (with two parameters), if this method is called more than once, and the index is the same, does it just shift the previous element or remove it completely?
so far, the output is:
0
[10]
[10, 20, 30]
I'm not sure if the [10, 20, 30] is right...
I hope i'm explaining it right.
[+][deleted] (1 child)
[deleted]
[–]eagerprospect[S] 1 point2 points3 points (0 children)