Difference between Array And ArrayList
SR
|
Array
|
ArrayList
|
1
|
Array has a fixed length
|
it will grow as you ad elements to it
|
2
|
Array can store value must be of similar data type .
|
ArrayList value may be differ it can store any object value
|
3
|
store value in contiguous memory location
|
store value in contiguous memory location
|
4
|
Array start with a index of 0
|
ArrayList start with a size of 0
|
5
|
In an array you have to track down yourself how many elements are in the array
|
you can always know how many elements contains an ArrayList by calling it's size() method
|
6
|
It does not Shrink
|
when you remove an element from an ArrayList it shrinks automatically
|
No comments:
Post a Comment