Frage im Vorstellungsgespräch bei Revature

What is an array / arraylist? What are the differences?

Antwort im Vorstellungsgespräch

Anonym

17. Nov. 2020

In Java, an array is a collection of the same type of element with a contiguous memory address. The array has a fixed length which means it cannot increase or decrease. ArrayList is part of the collection frame-work in java. it is basically a dynamic array that can grow and shrink as data in it changes. The biggest difference in length can be changed on runtime for Arraylist while array cannot expand. The array can take non-primitive or primitive data types while ArrayList only takes Primitive data types