Results 1 to 5 of 5
  1. #1
    ladykrimson is offline Member
    Join Date
    Oct 2010
    Posts
    69
    Rep Power
    0

    Default Dynamic String Array?

    Is it possible to make a dynamic string array? If so, how would one go about it?

  2. #2
    Ronin is offline Senior Member
    Join Date
    Oct 2010
    Posts
    392
    Rep Power
    5

    Default

    ladykrimson,

    By "dynamic", do you mean one which changes size frequently?
    If so then have a look at something such as ArrayList.

    Regards.

  3. #3
    ladykrimson is offline Member
    Join Date
    Oct 2010
    Posts
    69
    Rep Power
    0

    Default

    Quote Originally Posted by Ronin View Post
    ladykrimson,

    By "dynamic", do you mean one which changes size frequently?
    If so then have a look at something such as ArrayList.

    Regards.
    I would like to create one of which the size is unknown. Usually, you have to declare a size for an array, but what if one does not know the size?

  4. #4
    pbrockway2 is offline Moderator
    Join Date
    Feb 2009
    Location
    New Zealand
    Posts
    4,565
    Rep Power
    12

    Default

    A List (like ArrayList etc) is good for cases where the size is unknown as well as where the size is dynamic.

  5. #5
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,423
    Rep Power
    20

    Default

    If the size is known before you add any elements, and does't change thereafter, you can still use an array. Remember that the size used for declaring an array can be a variable.
    Java Code:
    int size = 6;
    int[] intArray = new int[size];
    db

Similar Threads

  1. How to create dynamic string object???
    By Stephen Douglas in forum New To Java
    Replies: 8
    Last Post: 04-12-2010, 02:35 AM
  2. How increase dynamic array?
    By artemff in forum New To Java
    Replies: 5
    Last Post: 01-01-2010, 12:22 AM
  3. Convert Char Array to String Array
    By Mayur in forum New To Java
    Replies: 8
    Last Post: 10-12-2009, 11:41 AM
  4. [SOLVED] Dynamic String -> Date Handeling
    By vagetoanima in forum Advanced Java
    Replies: 2
    Last Post: 03-31-2009, 06:43 PM
  5. Replies: 1
    Last Post: 08-03-2007, 10:52 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •