Difference between array and arraylist.
Answer Posted / prem
Array:
It is mainly used to store and retrive similar datatype
elements.
It is a limited storage.
So it's size not growable and shrinkable.
It will create array out of bound exception while we adding
more elements in an array after exceeding array size..
While we remove elements from array,the array size will be
same.size will not get reduce.
ArrayList:
It is a class.
It is a collection.
It is used to store different datatype objects.
It is growable and shirnkable.
So whenever we add elements in an ArrayList the size of
ArrayList will grow..While we remove element from an
ArrayList the size of ArrayList will get reduce..
So memory will get save..
| Is This Answer Correct ? | 3 Yes | 0 No |
Post New Answer View All Answers
What is the difference between superclass and subclass?
What is file in java?
What is the use of generics? When was it added to the Java development Kit?
What is namespace in java?
How can we make a class virtual?
How do you make a thread in java?
Difference between collection, collection and collections in java?
What string is utf8?
What is parseint?
Why string is a class?
What is the maximum length of a url?
How does hashset works in java?
Explain the importance of import keyword in java?
How do you do descending order in java?
What is boolean flag in java?