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


Please Help Members By Posting Answers For Below Questions

Is hashset ordered java?

590


Explain where variables are created in memory?

588


In Java list the methods that can be overridden?

575


What is method in research paper?

577


What is ternary operator?

570






What is java console application?

561


State differences between C and Java?

669


What is the reflection?

565


Explain about assignment statement?

600


What are void pointers?

716


what is anonymous class in java?

552


Give the hierarchy of inputstream and outputstream classes.

622


What technique is carried out to find out if a particular string is empty?

576


Does it matter in what order catch statements for filenotfoundexception and ioexception are written?

512


What does it mean to be immutable?

552