ANS) Array and Collection are somewhat similar with respect to storing the references of objects and manipulating the data . But they differ in many ways. The main differences between the array and Collection are explained below :
This blog explains the installation and usage of the Java programming language. It also contains examples for standard programming tasks.This is used to enhance the java programming skills.
Array | Collection |
Arrays are always of fixed in size. | Collection's size can be changed dynamically as per need. |
User can not increase or decrease the length of the array according to their requirements at runtime. | User can increase or decrease the length of the Collection's according to their requirement at runtime. Collection's size grow automatically as and when requires. |
Arrays can only store homogeneous or similar type of objects | Collections supports both homogeneous and heterogeneous objects to store. |
Arrays cannot provide the ready-made method support for user requirements such as sorting, searching of the objects. | Where as Collections have ready-made method support for user requirements |
No comments:
Post a Comment
Hello Buddy, if you have any doubts or need any clarification , feel free to comment. Thanks.