What is difference between Arrays and ArrayList ?
Arrays |
ArrayList |
The Arrays are
created of fix size. |
ArrayList is of not
fix size. |
The size of array
cannot be incremented or decremented 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(); |
Array can be
multidimensional. |
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 |