Untitled Document

Subscribe here to get updates on new Videos

 

23. Difference between Arrays and Collections?

 

 

 

previoushomenext

 

Arrays Collections
1. Arrays are fixed in size. 1. Collections are growable in nature. i.e. based on our requirement we can increase or decrease the size.
2. Wrt memory arrays are not recommended to use. 2. Wrt to memory collections are recommended to use.
3. Wrt Performance Arrays are recommended to use. 3. Wrt Performance Collections are not recommended to use.
4. Array can hold only homogeneous datatype eleements. 4. Collections can hold both homogeneous and heterogeneous elements.
5. There is no underlying data structure for arrays and hence readymade method support is not available. 5. Every Collections class is implemented based on some standard data structure. Hence readymade method support is available for every requirement.
6. Array can hold both primitives and object types
6. Collections can hold only objects but not primitives.