This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Regarding collection. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Regarding collection." Watch "Regarding collection." New topic
Author

Regarding collection.

Mani vannan
Ranch Hand

Joined: Aug 21, 2004
Posts: 185
1. In a collection class, usually we dont specify the no of objects intially. How is it getting allocated dynamically?

2. Is there anyway that one can alter an array's size without altering it declaration?


Manivannan
Jeff Albertson
Ranch Hand

Joined: Sep 16, 2005
Posts: 1780
1. That depends on the implementation. Compare ArrayList which implements
a List using an array, and LinkedList which implements a List using link
elements.

2. I think what you are really asking is if arrays can dynamically change
their length: no, they cannot.


There is no emoticon for what I am feeling!
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

This is a nice beginner-level question, so let's move it to Java in General (Beginner).


[Jess in Action][AskingGoodQuestions]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Regarding collection.
 
Similar Threads
Tech Word Game
WA #1.....word association
Collections
Invalid query?
differences