Bookmark Topic Watch Topic
  • New Topic

How to increase Arry size

 
rajesh kumar rayavarapu
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Report post to moderator
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
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Report post to moderator
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.
 
Garrett Rowe
Ranch Hand
Posts: 1296
  • Mark post as helpful
  • send pies
  • Report post to moderator
Did you look at the reply that was given when you asked this question yesterday?
 
    Bookmark Topic Watch Topic
  • New Topic