Which of the following are benefits of ArrayList over an array?
Select 1 option
Correct Option is : A
A. is correct.
An ArrayList resized dynamically at run time as per the situation.
An array cannot be resized once created.
This reduces the amount of boiler plate code that is required to do the same task using an array.
B. is wrong.
Because of additional internal data structure and pointers, it actually consumes a little more memory than an array.
C. is wrong
An ArrayList, just like an array is not thread safe.
If you have multiple threads trying to add and remove elements from an ArrayList, you have to write additional code to ensure thread safety.
D. is wrong
Since ArrayList is a generics enabled class, it helps you write type safe code.