wood burning stoves 2.0*
The moose likes Java in General and the fly likes Major difference between Array and ArrayList? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Major difference between Array and ArrayList?" Watch "Major difference between Array and ArrayList?" New topic
Author

Major difference between Array and ArrayList?

Kaustubh G Sharma
Ranch Hand

Joined: May 13, 2010
Posts: 1270

What are the major differences between array and arraylist or rest of the collections...


kaustubh


No Kaustubh No Fun, Know Kaustubh Know Fun..
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

A good place to start is here.


[My Blog]
All roads lead to JavaRanch
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

A quick difference:
A classic array: Easy to use, but can't grow dynamically.
An Array Class: An class with static utility method
An ArrayList class: An dynamic array list.


[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19651
    
  18

Don't forget that arrays can store primitives whereas ArrayLists cannot - the closest they get to storing primitives is storing wrapper objects (Integer etc) in combination with auto-boxing.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

As a side note : ArrayList is nothing but an array data structure
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19651
    
  18

Not true. It uses an array for storage, true, but it adds so much more behaviour that you cannot call it an array anymore. It's a List, period.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Major difference between Array and ArrayList?
 
Similar Threads
please tell me
java
array and arraylist
pmr
Array or ArrayList