54. What is the difference between ArrayList and Array?

What is the difference between ArrayList and Array?

  • Array has fixed size, so the size of array can not be changed after initializing. On the other hand, array list has dynamic size, so it will be automatically increase when we add an element and exceed the size of that ArrayList.
  • Array can hold both primitive data type and reference data type, but ArrayList only can hold reference data type
    If you want to store primitive data type in ArrayList, you must use wrapper class
  • ArrayList provide many utilities method to help manipulating with collection easier

Leave a Reply

Your email address will not be published. Required fields are marked *