aspose file tools*
The moose likes Beginning Java and the fly likes Difference between array and arraylist Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Difference between array and arraylist" Watch "Difference between array and arraylist" New topic

Difference between array and arraylist

Kandi Srinath

Joined: May 22, 2010
Posts: 1
Can anyone suggest regarding this topic.
Rob Spoor

Joined: Oct 27, 2005
Posts: 19672

Arrays can hold primitives and have a fixed length. ArrayList is a class that implements List that can only store objects and can grow as more elements are added.

But you could have found this out if you had checked the Java Language Specification for arrays and the Javadoc pages for ArrayList (just click on the word!).

How To Ask Questions How To Answer Questions
Jim Hoglund
Ranch Hand

Joined: Jan 09, 2008
Posts: 525
They are very different beasts. Array is a more foundational concept, very
powerful and very general purpose. List is a utility interface with methods
like clear(), add() and remove(). The class ArrayList is a "Resizable array
implementation of the List interface." It uses an array behind the scenes.

Jim ... ...

Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14114

Arrays are a built-in feature of the Java programming language and JVM; ArrayList is just a class like any other class.

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
Rob Spoor

Joined: Oct 27, 2005
Posts: 19672

Which uses an array for its internal storage.
I agree. Here's the link:
subject: Difference between array and arraylist