Difference between array and arraylist | Sololearn: Learn to code for FREE!

+10

Difference between array and arraylist

Why do I need to use array until an array-list?

5/13/2018 4:02:57 AM

Alejandro Rollano

7 Answers

New Answer

+18

Array: Simple fixed sized arrays that we create in Java. ArrayList : Dynamic sized arrays in Java that implement List interface. Array is a fixed size data structure while ArrayList is not. One need not to mention the size of Arraylist while creating its object. Even if we specify some initial capacity, we can add more elements. Array can contain both primitive data types as well as objects of a class depending on the definition of the array. However, ArrayList only supports object entries, not the primitive data types (when we Add a primitive type to an ArrayList it is internally boxed to Object type).

+3

array is static in the execution and arralist you can have n elements is dynamic

+2

Thank you very much guys to taking the time to answer ^^

+1

the fact is array :-> is a collection of same type of data. whereas arraylist :->is a collection of arrays..

+1

In array we only written similar datatype variables but incase of list we write different datatype variables ..

+1

it is type of data type😊👌👍

-1

in arraylist you can direct access with the values like arraylist a=new arraylist() a.add(5); a.add(7); etc.