What is difference between Array and ArrayList ?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What is difference between Array and ArrayList ??

20th Jan 2017, 3:02 PM
SHASHI
SHASHI - avatar
3 Answers
+ 5
Array is fixed size but Arraylist is not fixed size. If you use array you need to assign fix size of the array and you not able to use more then that. But if use ArraList no need to assign any size. If you more it will enlarge automatically or delete data shrink the itself.
20th Jan 2017, 3:38 PM
Faruque Hossain
Faruque Hossain  - avatar
+ 1
thankx
20th Jan 2017, 3:40 PM
SHASHI
SHASHI - avatar
0
In Java language: ArrayList can not store primitive data types (like int , float , double) it can only contain Object type data. An Array can contain both primitive data types as well as objects. They have different methods for finding thier length: ArrayList is provided by the size() method Array has the length variable which returns the length of the array See more at: http://javahungry.blogspot.com/2015/03/difference-between-array-and-arraylist-in-java-example.html
20th Jan 2017, 4:22 PM
Greg Oboroceanu
Greg Oboroceanu - avatar