ArrayList
So arrays are like tables that keep track of a number of values. The problem is we need to know how many values. The alternative is ArrayList which you dont need to know many values.
To use an ArrayList you need to import it.
Then declare it:
(If you want it to hold integers you would say:
[note arraylists cant hold primitive data, thats way we are using an Integer class]
Now to add values we might say
or
Now to see if you arraylist has a value you could say
or any of these methods.
|