To access an element in the ArrayList
, use the get()
method and refer to the index number:
Example
cars.get(0);
Remember: Array indexes start with 0: [0] is the first element. [1] is the second element, etc.
Practice Excercise Practice now
To access an element in the ArrayList
, use the get()
method and refer to the index number:
cars.get(0);
Remember: Array indexes start with 0: [0] is the first element. [1] is the second element, etc.
Practice Excercise Practice now