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

Connected

Exercise

Setting up a Collection

Soon, you will learn more about Collection and Map data structures. However, first, explore the required import, construction, and parameterization of one of the Collection types, specifically an ArrayList.

Instructions

100 XP
  • Import all the types from the Java Collections Framework package.
  • Create a variable called list that will hold an ArrayList of strings, using generics to specify String on ArrayList.
  • Set list to a new instance of ArrayList using the parameterized constructor ArrayList<String>.