Consider a List of strings that contains the following strings in the order given:
"bob" "ann" "sue" "ned": [0] [1] [2] [3] respectively
Give the contents of the List after each operation.
a. list.insert(2, "bob");
b. list.insert(5, "ann");
c. list.remove(0);
d. list.remove(3);
I got...bob, ann, bob, sue, ned;
bob, ann, bob, sue, ned, ann;
ann, bob, sue, ned, ann;
ann, bob, sue, ann
is this correct?
Aucun commentaire:
Enregistrer un commentaire