|
-
May 9th, 2000, 11:10 AM
#1
redemensioning arrays
I am a new to Java. I have, to this point, been using VB for all of my developmental needs. In VB, once you have an array declared, say with 15 items, you can "redimension" it and make it bigger or smaller. I have read some books and looked online but have not found how to do this in Java. I fully understand how to declare an array and use it, just need to know how to "re-size" it. Any help is appreciated.
Thanks,
Rippin
-
May 9th, 2000, 08:08 PM
#2
Re: redemensioning arrays
If you're not worried about the data in the array, you can just use the following:
myArray = new int[somenumber];
However, if you need to maintain the data that is in the array, I suggest you use an instance of the Vector class. It is basically an array which can be resized, but it takes care of this on its own.
-------------------------------------------
weaver
icq# 64665116
Please rate this post.
http://weaver.x7.htmlplanet.com
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|