Which of the following is a difference between ArrayList obj

Which of the following is a difference between ArrayList objects and arrays?

an array can store only one type of object, but an array list can store a variety of kinds of objects.

an array is fixed in size, whereas an array list will automatically resize based on how many elements are stored in it.

an array cannot be used to support polymorphism, but an array list can.

you don’t have to create the array itself, whereas you do have to create the array list object

Solution

The difference between ArrayList objects and arrays is :-

An array is fixed in size,

whereas an ArrayList will automatically resize based on how many elements are stored in it.

Explanation :-

* Java arrays are of a fixed length. After arrays are created, they cannot increase or decrease.

* ArrayLists are created with an default size. When the size is increased, the collection is automatically increased. When objects are removed, the ArrayList may be reduced.

Which of the following is a difference between ArrayList objects and arrays? an array can store only one type of object, but an array list can store a variety o

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site