Array Vs ArrayList In Java Video

preview_player
Показать описание
Array vs ArrayList is one of the very common Java interview Questions. In this tutorial learn the major differences between Array and ArrayList.

Arrays Points

Array size is fixed during declaration.
Array can access using array name & index
Array can store primitives and objects.
Array has length field for finding total elements.
Array allows multidimensional data
Arrays only allow homogeneous data


ArrayList Point

ArrayList size is not fixed and growable.
ArrayList accesses data using get method and index
ArrayList can only store objects. Wrapper needed for primitives.
ArrayList uses size() method to find the total elements.
ArrayList can only handle single dimensional data
ArrayLists without type parameter allow all types of objects
Рекомендации по теме
Комментарии
Автор

Thank you. That was amazingly explained. Now its crystal clear.

riki
Автор

perfectly explained.... clear vision of the Thank you very much

ravik
Автор

It was a detailed explanation with good set of examples..request you to make more videos of this type based on Java interview related

anjonroy
Автор

So java ver5 made arraylist to be homogeneous too? As we already declare the type of data we feed into..like when we write
List <String>names= new ArrayList<String>();
Now we can only add string type datas ..which makes it homogeneous again right?

cozmos
Автор

Sorry, I do not understand.
array size fixed during declaration.
but I use:
String[] message = new String[]{}; --> No need to fixed size.
This is called dynamic size ?
I misunderstand ?

bamossza