Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-03-2009, 11:57 PM
Member
 
Join Date: Feb 2009
Posts: 32
Rep Power: 0
VinTiger is on a distinguished road
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.
Bookmark Post in Technorati
Reply With Quote
  #2 (permalink)  
Old 05-04-2009, 12:52 AM
Fubarable's Avatar
Moderator
 
Join Date: Jun 2008
Posts: 6,326
Rep Power: 8
Fubarable is on a distinguished road
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.
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 05-04-2009, 02:01 AM
Member
 
Join Date: Feb 2009
Posts: 32
Rep Power: 0
VinTiger is on a distinguished road
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.
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 05-04-2009, 02:47 AM
Fubarable's Avatar
Moderator
 
Join Date: Jun 2008
Posts: 6,326
Rep Power: 8
Fubarable is on a distinguished road
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.
Bookmark Post in Technorati
Reply With Quote
  #5 (permalink)  
Old 05-05-2009, 08:16 PM
Member
 
Join Date: Dec 2008
Posts: 3
Rep Power: 0
viper81 is on a distinguished road
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.
Bookmark Post in Technorati
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Multidimensional array Torgero New To Java 20 03-23-2009 12:36 AM
Navigate to behind pages when I am in a wizard Radhikaibm SWT / JFace 2 09-09-2008 08:42 AM
Multidimensional hashtable? jklsemicolon New To Java 6 08-17-2008 06:23 AM
[SOLVED] Navigate with Cursor keys hannehomuth Advanced Java 7 07-25-2008 01:22 PM
Multidimensional arrays Java Tip Java Tips 0 11-05-2007 06:07 PM


All times are GMT +2. The time now is 05:30 AM.



VBulletin, Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2009, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org