Home / Expert Answers / Computer Science / question-1-what-would-be-the-output-of-the-following-code-arraylist-list-new-arraylist-list-a-pa292

(Solved): QUESTION 1 What would be the output of the following code? ArrayList list = new ArrayList(); list.a ...




QUESTION 1
What would be the output of the following code?
ArrayList<Integer> list = new ArrayList<Integer>();
list.add(1);
l
QUESTION 1 What would be the output of the following code? ArrayList list = new ArrayList(); list.add(1); list.add(7); list.add(22); list.add(1, 100); for(int i=0; i < list.size(); i++) System.out.print(list.get(i) + " "); list.set(2, 50); list.remove(1); println(); for(int i = list.size(); i > list.size()/2; i--) System.out.print(list.get(i) + " "); a. 1 100 7 22 22 50 100 b. 1 100 7 22 22 50 1 O 1 100 7 22 150 22 O d. 22 7 100 1 22 50 1


We have an Answer from Expert

View Expert Answer

Expert Answer


list.add(x) - add x to end of list list.add(index, x) -
We have an Answer from Expert

Buy This Answer $5

Place Order

We Provide Services Across The Globe