1.
Q8: The value of
beta.get(0)
is .
add()
. Elements not yet added do not exist until explicitly inserted.
get(index)
which will be the index for the element to be accessed
arrayListName.get(index)
returns the value stored at that index
arrayListName.size() - 1
, inclusive; otherwise IndexOutOfBoundsException
occurs
set(index, value)
which will be the index for the element to be replaced
ArrayList<Integer> beta;
beta
after the execution of these statements.
int size = 4;
beta = new ArrayList<Integer>();
beta.add(50);
for (int i = 1; i < size; i++)
beta.add(beta.get(i-1) - 2);
beta.get(0)
is .
beta.get(1)
is .
beta.get(2)
is .
beta.get(3)
is .