Results 1 to 5 of 5
  1. #1
    VinTiger is offline Member
    Join Date
    Feb 2009
    Posts
    32
    Rep Power
    0

    Default Navigate through a multidimensional array

    Hi guys,

    Can anyone point me in the right direction of how to navigate through a multidimensional array? I have a program that reads a file and prints the info. I now need to modify the program to read the file into an multidimensional array, the program then needs to load and print the first record of the file. The user then need to be able to navigate back and forth through the array using different keys....

    If anyone knows of an online tutorial or guidence in how to do this I would greately appreciate it.

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    You may only need a one dimensional array here.

    I am guessing here, but I have the feeling that each record holds a set collection of information such as a name, id number, and other numbers and or strings, and that this is one "dimension" of your array, and that the other dimension is the collection of multiple such records. If I am correct then first you should create a class that holds all the information contained in one record. Then you'll want either a single dimensional array of objects of this class, or often times better in this situation is a Collection such as an ArrayList of these objects.

    If my assumptions are wrong, please correct them. Either way, you may wish to provide more information regarding the specifics of your problem for a more helpful answer.

    Best of luck.

  3. #3
    VinTiger is offline Member
    Join Date
    Feb 2009
    Posts
    32
    Rep Power
    0

    Default

    Thanks:)

    How do I assign a key to go forward through the array when I have the file read into the array? The program only shows the first 7 words in the file separated by a comma. I now need to let the user go forward through the rest of the file to see the remaining content, but I don't know how to accomplish this.

  4. #4
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    It's hard to know given what you've told us so far. I suggest that you give more information. JavaRanch has a decent FAQ on how to ask questions so that they are more easily answered. You can find this link here: JavaRanch - How To Ask Questions On Java Ranch
    And in particular this subsection: JavaRanch - Tell The Details

    Good luck.

  5. #5
    viper81 is offline Member
    Join Date
    Dec 2008
    Posts
    3
    Rep Power
    0

    Default

    Well, according to my understanding, your program shows the first 7 words in the file which has been stored into the array right? so i guess you know the index of the word 7th in the array. From this point, what you need to do is just to use the loop to traverse (starting from the index found earlier to the end of arrary) and output the content.

Similar Threads

  1. [SOLVED] Multidimensional array
    By Torgero in forum New To Java
    Replies: 20
    Last Post: 03-22-2009, 11:36 PM
  2. Navigate to behind pages when I am in a wizard
    By Radhikaibm in forum SWT / JFace
    Replies: 2
    Last Post: 09-09-2008, 07:42 AM
  3. Multidimensional hashtable?
    By jklsemicolon in forum New To Java
    Replies: 6
    Last Post: 08-17-2008, 05:23 AM
  4. [SOLVED] Navigate with Cursor keys
    By hannehomuth in forum Advanced Java
    Replies: 7
    Last Post: 07-25-2008, 12:22 PM
  5. Multidimensional arrays
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 11-05-2007, 05:07 PM

Posting Permissions

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