What is Array?
An array is the collection of similar or homogeneous collection of data. It means an array can contain one type of data only, either all integers, all characters or frictional numbers.
Different between Array and Array list.
- Arrays are static in nature. Arrays are fixed length data structures. You can’t change their size once they are created.
- Arrays can hold both primitives as well as objects.
- Arrays can be iterated only through forloop or for-each
- The size of an array is checked using length
- .Arrays doesn’t support generics.
- Arrays are not type safe.
- Array List is dynamic in nature. Its size is automatically increased if you add elements beyond its capacity
- Array List can hold only objects.
- ArrayList provides integrators to iterate through their elements.
- The size of an Array List can be checked using size ()
- ArrayList supports generics.
- ArrayList are type safe.
Please follow and like us: