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 How to increase Arry size 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
Reply locked New topic
Author

How to increase Arry size

rajesh kumar rayavarapu
Greenhorn

Joined: May 16, 2007
Posts: 12
Hi, iam new to the java.
How to increase the array size dynamically?
(I have faced this question in pone of the interview)

means if i take arry[3]={0,1,2} and then i want insert 3 in the same arry.Please send to me i have faced this question in one of the interview.

thanks,
rajesh
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

In Java, the size of an array is set when it's created, and cannot be changed.

For a "re-sizable" array, there are different collection options, like ArrayList.


"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
Garrett Rowe
Ranch Hand

Joined: Jan 17, 2006
Posts: 1296
Did you look at the reply that was given when you asked this question yesterday?


Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them. - Laurence J. Peter
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to increase Arry size
 
Similar Threads
Extending class with private constructor.
Increasing Array size
Diff between Framework and API
How to run a java file with any one JRE version when two JRE's are available.
Codes rule in interview