0 votes
in C Plus Plus by

What are the main difference between Array and Arraylist

1 Answer

0 votes

In array we need to define the size at the time of declaration and on another hand we can change the size dynamically.

Arrays can contains both primitive data types as well as objects on the other hand Arraylist can have only objects and not allowed any primitive data types.

Arrays are not type parameterized on the other hand Arraylists are type

When we need to add data in array we must specifiy the index on ther hand we donot need and index in arraylist

In array we cannot insert values of different data types on another hand we can store different data types in arraylist.

Related questions

0 votes
asked Oct 23, 2020 in JAVA by rahuljain1
0 votes
asked Nov 8, 2022 in Swift by SakshiSharma