Example & Tutorial understanding programming in easy ways.

What is difference between Arrays and ArrayList ?

What is difference between Arrays and ArrayList ?



The Arrays are created of fix size.

ArrayList is of not fix size.

The size of array cannot be incremented or decremented
int [] intArray= new int[1];

intArray[2]   // will give ArraysOutOfBoundException.


ArrayList the size is variable.

Once the array is created its elements cannot be added or deleted from it at runtime.

ArrayList the elements can be added and deleted at runtime

List list = new ArrayList();
list.remove(0) // will remove the element from the 1st location.


Array can be multidimensional.
int[][][] intArray= new int[1][1][1];   // 3 dimensional array    


ArrayList is one dimensional

To create an array the size should be known or initialized to some value.

ArrayList is all about dynamic creation we donít need any size at initialisation time.

Array initialized without caring the memory wastage.

There is no wastage of memory

Read More →
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!