Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
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 Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply locked New topic

How to increase Arry size

rajesh kumar rayavarapu

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.

marc weber

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
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:
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