-3.2 Consider the ArrayList object named list containing these Integers:
Question
-3.2 Consider the ArrayList<Integer> object named list containing these Integers: list = { 1, 2, 3,
4, 5, 4, 3, 2, 1, 0 }
-What are the contents of list after this loop completes?
for (int i = 1; i < 10; ++i)
{
list.set(i, list.get(i) + list.get(i-1));
}
I know this first answer on the list is
first round
i= 1 so 1 + (1-1) = 1 ; ++i
second round
i= 2 so 3 + (3) = 3 ; ++i
third round
i= 3 so 3 + (3-1) = 5 ; ++i
thought I understood this but i feel a little lost. Its been a few months since my first programming with java class and I barely passed that class…help please
Looking for a Similar Assignment? Order now and Get 10% Discount! Use Coupon Code "Newclient"
