To remove an item, use the remove() method:

Example

cars.remove("Volvo");
 

To remove all items, use the clear() method:

Example

cars.clear();



Practice Excercise Practice now