Difference between traditional java Array and Arraylist class

Difference between traditional java Array and Arraylist class.

ArrayArraylist class
It is a fixed length structure and once its created its size cannot be changed.It is a variable length collection class and can resize itself depending on its capacity and load factor.
It cannot use generics as the array instance knows its type and can throw an ArrayStoreException if the array is not convertible.It allows to use generics to ensure the type-safety.
It provides length variable to denote the length of an array.It provides the size() method to calculate the size of the ArrayList.
It contains both the primitives and the objects.It cannot store the primitives but it can store the objects.
Assignment operator is used to store elements in an array.Add() method is used to store elements in the ArrayList.
It is mandatory to provide the size of the array while creating it.An instance can be created without specifying the size.
Difference between pass by value and pass by reference
Difference between pass by value and pass by reference - In pass by value, a copy of variable is passed to the method; the values of the variable can’t be changed in the method.....
What are access modifiers in JAVA?
What are access modifiers in JAVA?
Define Savepoints in a transaction
Define Savepoints in a transaction - Using Savepoint, you can mark one or more places in a transaction and you can perform rollback to one of those...
Post your comment