Differences Between Array and ArrayList in JavaLast Updated : 13 Jan 2026 In Java, array and ArrayLists are well-known data structures. An array is a basic functionality provided by Java, whereas an ArrayList is a class of the Java Collections framework. It belongs to java.util package. Java ArrayAn array is a dynamically created object. It serves as a container that holds a constant number of values of the same type. It has a contiguous memory location. Once an array is created, we cannot change its size. We can create an array by using the following statement: The above statement creates an array of the specified size. When we try to add more than its size, it throws an ArrayIndexOutOfBoundsException. For example: To read more Java Array Example of an ArrayIn the following example, we have simply created an array of length four. ExampleCompile and RunOutput: 12 2 15 67 Java ArrayList ClassIn Java, ArrayList is a class of the Collections framework. It implements List<E>, Collection<E>, Iterable<E>, Cloneable, Serializable, and RandomAccess interfaces. It extends the AbstractList<E> class. We can create an instance of ArrayList by using the following statement: An array in Java internally backs an ArrayList. The resize operation in ArrayList slows down the performance as it involves a new array and copying content from the old array to the new array. It calls the native implemented method System.arraycopy(sec, srcPos, dest, destPos, length). We cannot store a primitive type in an ArrayList. So, it stores only objects. It automatically converts a primitive type to an object. For example, we have created an ArrayList object, The JVM converts it into an Integer object through auto-boxing. To read more Java ArrayList Example of ArrayListIn the following example, we have created an instance of ArrayList and are performing iteration over the ArrayList. ExampleCompile and RunOutput: 12.4 34.6 56.8 78.9 Similarities
Array Vs. ArrayListThe following table describes the key differences between an array and an ArrayList:
Next TopicJava Tutorial |
We request you to subscribe our newsletter for upcoming updates.

We deliver comprehensive tutorials, interview question-answers, MCQs, study materials on leading programming languages and web technologies like Data Science, MEAN/MERN full stack development, Python, Java, C++, C, HTML, React, Angular, PHP and much more to support your learning and career growth.
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India