Differentiate between Array and ArrayList in Java?
Array Vs ArrayList in Java
- Array is basic feature of Java available in every Java class by default while ArrayList is a class that you need to import from java.util package
- Arrays can store a fixed length data while ArrayList can store dynamic data
- Arrays can have primitive type and object type while ArrayList cannot have primitive types
- We can create an instance of ArrayList class without specifying size, Java will create an instance of ArrayList class with default size but its mandatory to provide size of Array
Comments
Post a Comment