Difference between array and ArrayList
- An array uses the vector array to store the elements. ArrayList uses the Linked List to store the elements.
- The size of the Array must be defined until redeem is used (vb). No need to specify the storage size in Arraylist.
- An array is a specific data type storage. ArrayList can be stored everything as an object.
- No need to do the type casting in an array. Every time type casting has to done in ArrayList.
- An array will not lead to Runtime exception. ArrayList leads to the runtime error exception.
- The elements cannot be inserted or deleted in between an array. Elements can be inserted and deleted in ArrayList.
- There is no built-in members to do ascending or descending in an array. ArrayList has many methods to do the operations like Sort, Insert, Remove, Binary Search, etc.