CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 1999
    Location
    Texas
    Posts
    96

    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


  2. #2
    Join Date
    Jan 2000
    Location
    Canada
    Posts
    249

    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
  •  





Click Here to Expand Forum to Full Width

Featured