An array is an indexed collection of fixed number of homogeneous data elements.
The main limitations of Object Arrays are

  1. Arrays are fixed in size i.e once we created an array there is no chance of increasing or decreasing it’s size based on our requirement.
  2. Arrays can hold only homogeneous data elements.
    Student [] s = new Student [600];
    s[0] = new Student;
    s[1] = new Integer(10);//compile time error :can not convert Integer to Student
    s[2] = “abc”;//compile time error :can not convert String to Student

    We can resolve this problem by using object Arrays.
    Object [] o = new Object [600];
    o[0] = new Student;
    o[1] = new Integer(10);
    o[2] = “abc”;
    i.e By using Object Arrays we can hold heterogeneous data elements.

  3. For the Arrays there is no underlying Data Structure i.e for every requirement we have to code explicitly and there is no default ready made support(like sorting, searching).We can’t represent array elements in some sorting order by default. We can’t prevent duplicate
    object insertion etc…
  4. To resolve the above problems of arrays, Sun people has introduced ‘collections concept’. Collections are grow able in nature i.e based on requirement we can increase or decrease the size.Collections can hold heterogeneous data elements also.

  5. Every collection class has implemented based on some data structure.Hence for every requirement ready made method support is possible.We can represent all the elements in some sorting order. We can prevent duplicate object insertion by default

Comparison Between collections and Arrays

Collections arrays
Collections are not fixed In size Arrays are fixed In size
With respect to memory collections are good with respect to memory arrays are not good
With respect to performance collections shows worst performance With respect to performance the arrays are recommended to use
Collections can hold heterogeneous data elements Arrays can only hold homogeneous data elements
Every Collection class has built by using some Data structure There is no underlying Data Structure
Collection can hold only Objects but not primitives Arrays can hold both Objects and primitives