+ 10

Difference between array and arraylist

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

13th May 2018, 4:02 AM
Alejandro Rollano
Alejandro Rollano - avatar
7 Antworten
+ 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).
13th May 2018, 6:02 AM
Rusty.Metal
+ 3
array is static in the execution and arralist you can have n elements is dynamic
13th May 2018, 7:38 AM
Daniel Oseguera
Daniel Oseguera - avatar
+ 2
Thank you very much guys to taking the time to answer ^^
13th May 2018, 11:29 AM
Alejandro Rollano
Alejandro Rollano - avatar
+ 1
the fact is array :-> is a collection of same type of data. whereas arraylist :->is a collection of arrays..
14th May 2018, 5:25 PM
harsh Saxena :-> " Lokik "
+ 1
In array we only written similar datatype variables but incase of list we write different datatype variables ..
19th May 2018, 10:07 AM
dinesh kumar
dinesh kumar - avatar
+ 1
it is type of data type😊👌👍
19th May 2018, 4:56 PM
Rahul Ramachandra Kalal
Rahul Ramachandra Kalal - avatar
- 1
in arraylist you can direct access with the values like arraylist a=new arraylist() a.add(5); a.add(7); etc.
18th May 2018, 12:29 PM
Khushal Patel
Khushal Patel - avatar