ArrayList Code | Array Code |
---|---|
![]() |
![]() |
Notes:
Student[]
instead of
ArrayList<Student>
theList[i]
instead of
theList.get(i)
or theList.set(i)
theList.length
instead of
theList.size
length
is an attribute (public instance
variable), not a method, so there are no parentheseslength
specifies the capacity of the
array (the number of items it could hold), not
the number of array elements that you have set to meaningful
values. If the array is not full, you need to keep track of the
number of items actually in the array with a variable of your
own.