Difference between Array and ArrayList

Posted By: Matpal - June 08, 2011
1. Array is the object and it stores the object of same type

Eg : Its stores complete integer types or string types

int[] IntArray = new int[3];
string[] StringArray = new StringArray[2];

Arraylist is the collection in which we can store the
objects of any data type.

Eg : Arraylist Arr = new Arraylist()
Arr.Add(13); // Integer Type
Arr.Add(“google”); // String Type

2 . Arrays has the Fixed Lenght where as the Arraylist
varies the leghth as the objects Added.

In other words

array is the one which can save similar data typed elements.And the size is limited.
arraylist is a collection which is capable of saving
different data typed objects,And is growable.


Post a Comment

Note: Only a member of this blog may post a comment.