What is the difference between arrays and collection?

Array:

  1. You need to specify the size of an array at the time of its declaration. It cannot be resized dynamically.
  2. The members of an array should be of the same data type.

Collection:

  1. The size of a collection can be adjusted dynamically, as per the user’s requirement. It does not have fixed size.
  2. Collection can have elements of different types.
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s