Difference between array and arraylist.

Answers were Sorted based on User's Feedback



Difference between array and arraylist...

Answer / mohit

1-array is used for value type. but array list is used for reference type.
2-array is used for fixed size but aaray list is dyanamically increase at run time.
3-you can't resize an array but you can do resize the array list.

Is This Answer Correct ?    4 Yes 0 No

Difference between array and arraylist...

Answer / raja

The Methods Of ArrayList class are
1)Add
2)Remove
3)Clear

5)TrimToSize
6)Sort
7)Reverse

Is This Answer Correct ?    5 Yes 2 No

Difference between array and arraylist...

Answer / chinnu

Array:arrays is not for our requirement once we create a size next we cant change the size.in advance we cant estimate the size.its taking only homogeneous elements.


Array list:array list is same as collections and vectors.array list is or requirement we can change the size in advance also and estimate the size.its taking both homogeneous and heterogeneous elements .

Is This Answer Correct ?    4 Yes 1 No

Difference between array and arraylist...

Answer / 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

Difference between array and arraylist...

Answer / vk

Array is a collection of similar data types,ArrayList is not you can store any type of data types in AL.ArrayList will autometically increase 50% of the size which we allocated previously, but Array wasn't.

ArrayList al= new ArrayList();
al.add("a");
al.add(10);

both can be accepted in ArrayList.

Is This Answer Correct ?    4 Yes 1 No

Difference between array and arraylist...

Answer / abhay shukla

1) Array is the one which can save similar data type
elements and the size is limited.
2) Array list is a collection which is capable of saving
different data typed objects, and is grow able.
3) Array is the collection of values of the same data type.
Array list is a class

Is This Answer Correct ?    4 Yes 1 No

Difference between array and arraylist...

Answer / bhavani

ARRAY:collection of same data items.
2.array is always of fixed size.
3.initializing an array is too long,then it results in wastage
of memory in heap.
ARRAYLIST : Collection of different data objects.
2.Dynamic in nature.
3.automatic resizing of the list.
4.methods used is:add,remove,insert,clear,sort,reverse....

Is This Answer Correct ?    3 Yes 0 No

Difference between array and arraylist...

Answer / nikhil agrawal

array contain the similar datatype element and their size is fixedd where as arraylist contain object and their size is not fixed as aaray and it can grow dynamically. and we can applied so many method on arraylist like add,remove,clear,size etc

Is This Answer Correct ?    3 Yes 0 No

Difference between array and arraylist...

Answer / priya

Simply,

Array is static ie, Size Does not grow, its fixed

ArrayList is dynamic, By adding values, it grows

Is This Answer Correct ?    5 Yes 3 No

Difference between array and arraylist...

Answer / sitaram

Array is static,only one data type values are storing. Size
Does not grow, its fixed

ArrayList is dynamic,different data type values are storing.
By adding values, it grows

Is This Answer Correct ?    3 Yes 1 No

Post New Answer

More Core Java Interview Questions

How does linkedlist work in java?

0 Answers  


How do you sort arraylist in descending order?

0 Answers  


Any one can explain how the inerface uses in java. give with example.

1 Answers   IBM,


explain how many oops concepts available in java with realtime scenarios?

1 Answers   TCS,


What are parsers? Dom vs sax parser.

0 Answers  






what is the difference between static class and singleton class? can we create static class?

2 Answers   L&T, Octazen, Vamsi Labs,


What's the base class in java from which all classes are derived?

0 Answers  


Can an interface extands a class?

5 Answers  


What is the importance of hashcode() and equals() methods?

0 Answers  


Which container method is used to cause a container to be laid out and redisplayed in java programming?

0 Answers  


Can you create an object of an abstract class?

0 Answers  


How many bits does a boolean take?

0 Answers  


Categories