Results 1 to 2 of 2
Thread: Help with arrays
- 11-24-2009, 07:14 AM #1
Member
- Join Date
- Nov 2009
- Posts
- 1
- Rep Power
- 0
Help with arrays
Hello,
I'm a bit confused on how to do this. I'm supposed to open a dictionary file and store all of its values into an array. My guide tells me that I need to:
"read in the name of the dictionary file from command-line-arguments, then read in a dictionary of words from the data file, store each word in an array....."
I'm not exactly sure how to read the dictionary file from the command line arguments. Any help? :confused:
-
You don't. You read in the file name from the command line, then use that name to open a file for reading (myself I'd use a Scanner object for this. something like:
Java Code://pseudocode main method if the length of the args array is > 0 give args[0] to String fileName Create a File object using fiileName Use this File to create a Scanner object initialize a counter int to 0 while scanner's nextLine exists dictionary array [counter] gets assigned scanner's nextLine increment counter end while end main
Similar Threads
-
Arrays
By karabo101 in forum New To JavaReplies: 12Last Post: 10-11-2009, 05:02 PM -
Arrays
By swim_fan08 in forum New To JavaReplies: 7Last Post: 04-11-2009, 03:02 PM -
Need help with Arrays
By dietgal in forum New To JavaReplies: 21Last Post: 10-08-2008, 01:59 PM -
need help with arrays
By Jman in forum New To JavaReplies: 17Last Post: 07-21-2008, 02:34 AM -
2D-Arrays
By kbyrne in forum New To JavaReplies: 1Last Post: 02-07-2008, 10:08 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks