ArrayList Extra Steps


#1

Why do we have to import ArrayList when you can already create one-dimensional and two-dimensional arrays like you create a variable? For example, you can create a one dimensional array with integers like this:

int ArrayName[]

ArrayName[] = new int[size]

ArrayName[0] = int


#2

An ArrayList is a dynamic array

An Array is fixed in size, and can’t go over it; you would need to make another array and reassign values

An ArrayList’s size is flexible; you can remove and add values from zero to infinity

When you know the maximum size of the array, its preferable to use an Array
While I’m not sure of the lesson’s details, it may just be trying to familiarize you with using ArrayLists and objects in general so you may not “have” to use it


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.