Array vs ArrayList

Array:

An array is a collection of similar data types that can be accessed by index. Array allocates then static memory with consecutive section of memory blocks.

ArrayList:

ArrayList is a collection of objects of same or different types. ArrayList size can be dynamically increased or decreased as per the requirement.

Here is difference table of Array vs ArrayList

ArrayArrayList
Array stores a fixed number of elements.ArrayList is dynamic in term of size. If the number of elements exceeds, ArrayList size will increase or decreased as per requirement.
It contains both primitive data types and objects of a class.ArrayList does not contain the primitive data types but contains object entries.
Array does not have Generics feature.ArayList has Generics feature.
Array belongs to namespace SystemArrayList belongs to namespace System.Collection
Array cannot accept null.ArrayList can accept null.
Array Vs ArrayList

Leave a Reply

Your email address will not be published. Required fields are marked *