1. Learn
  2. /
  3. Courses
  4. /
  5. Data Types and Exceptions in Java

Connected

Exercise

Working with ArrayList

Constructing an ArrayList data structure and adding/removing objects to it is a very common task in Java. In this exercise, you will create a shopping list - as represented by a list of Strings, and add, remove, and change items on the list.

Instructions

100 XP
  • Import ArrayList for use in the application.
  • Construct a new ArrayList of Strings and set the shopList variable to it.
  • Add a second "milk" to the shopping list.
  • Change "bread" to "rye-bread" on the shopping list.