ArrayLists and Data Types

ArrayLists and Data Types

  • ArrayLists are designed to store collections of objects.

  • Class Data Types Only: ArrayLists can only hold class data types.

    • Examples:

      • Strings
      • Circles (assuming Circle is a class you've defined)
      • Other classes that you have created.
  • Primitives Not Allowed: ArrayLists cannot directly store primitive data types such as int or double.

AP Computer Science A - Unit 7

  • This note pertains to Unit 7 of the AP Computer Science A curriculum.