Here we will discuss all the differences between Array and ArrayList in Java.
Know Also : What is List Interface In Java ? and What is ArrayList in java ?
Array
|
ArrayList
|
Array is static in size.
|
ArrayList is dynamic in size.
|
Array uses Vector to store elements.
|
ArrayList uses LinkedList to store elements.
|
Array doesn’t support generic, so they are not type safe.
|
ArrayList support generic, so they are type safe.
|
Array contain primitive data type as well as Objects.
|
ArrayList only contain Objects
.
|
Array is traverse by for and forEach loop.
|
ArrayList is traverse by Iterator, for loop and forEach loop.
|
Array length is provided by length() method of object class.
|
ArrayList length is provided by size() method.
|
In array assignment operator is used to add elements.
|
In ArrayList add() method is used to add elements.
|
Array can be multi-dimensional.
|
ArrayList is always single-dimensional.
|
Array don’t have any built in methods.
|
ArrayList have many built in methods like sort(), remove(),
binarySearch() etc.
|
Array
|
ArrayList
|
Array can store null values.
|
ArrayList can also store null values.
|
Array allows duplicate elements.
|
ArrayList also allows duplicate elements.
|
No guarantee about elements order.
|
No guarantee about elements order.
|
Blog Author - Pushkar Khosla,
Software Developer by Profession with 3.0 Yrs of Experience , through this blog i'am sharing my industrial Java Knowledge to entire world. For any question or query any one can comment below or mail me at pushkar.itsitm52@gmail.com.
This blog is all about to learn Core Java ,Interview Programs and Coding tricks to polish your Java Knowledge. If you like the content of this blog please share this with your friends.
Software Developer by Profession with 3.0 Yrs of Experience , through this blog i'am sharing my industrial Java Knowledge to entire world. For any question or query any one can comment below or mail me at pushkar.itsitm52@gmail.com.
This blog is all about to learn Core Java ,Interview Programs and Coding tricks to polish your Java Knowledge. If you like the content of this blog please share this with your friends.



No comments:
Post a Comment