The Wayback Machine - http://web.archive.org/web/20200418093412/https://www.geeksforgeeks.org/array-vs-arraylist-in-java/amp/

Array vs ArrayList in Java

In Java, following are two different ways to create an array.

  1. Array: Simple fixed sized arrays that we create in Java, like below
          int arr[] = new int[10]   
  2. ArrayList : Dynamic sized arrays in Java that implement List interface.
          ArrayList<Type> arrL = new ArrayList<Type>();
          Here Type is the type of elements in ArrayList to
          be created
        

Differences between Array and ArrayList

As a side note, ArrayList in Java can be seen as similar to vector in C++.

 

This article is contributed by Pranjal Mathur. If you like GeeksforGeeks and would like to contribute, you can also write an article and mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above





Improved By : vivekranjan

Article Tags :
Practice Tags :