Identify two benefits of using ArrayList over array in software development.
Correct Answer: A,D
Explanation/Reference:
Explanation:
ArrayList supports dynamic arrays that can grow as needed. In Java, standard arrays are of a fixed length.
After arrays are created, they cannot grow or shrink, which means that you must know in advance how many elements an array will hold. But, sometimes, you may not know until run time precisely how large of an array you need. To handle this situation, the collections framework defines ArrayList. In essence, an ArrayList is a variable-length array of object references. That is, an ArrayList can dynamically increase or decrease in size. Array lists are created with an initial size. When this size is exceeded, the collection is automatically enlarged. When objects are removed, the array may be shrunk.
Recent Comments (The most recent comments are at the top.)
How arraylist helps in reducing memory footprint is not explained.