aspose file tools*
The moose likes I/O and Streams and the fly likes load words from file into a string array Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "load words from file into a string array" Watch "load words from file into a string array" New topic
Author

load words from file into a string array

Mark Vermeersch
Greenhorn

Joined: May 11, 2004
Posts: 17
Hello,

I have a file with on each line a word. I'm looking for a way to these words into a string array.
I suppose it's quite basic... Any clues?

Thanks!
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

This doesn't sound like a GUI question to me which is what this forum is for. So I am going to move this to the I/O and Streams forum so you will get better help.


GenRocket - Experts at Building Test Data
Ali Gohar
Ranch Hand

Joined: Mar 18, 2004
Posts: 572
You can use BufferedReader class to read the Words from the file in the form of String and then store these strings in the Array as needed. Post you code if you are facing any problems in doing that.
Avi Abrami
Ranch Hand

Joined: Oct 11, 2000
Posts: 1134

Hi Mark,
Below code was compiled and run on Windows XP using J2SE SDK 1.4.2_04.
It's not great code, but it's intended merely to help you get started.

Allow me to suggest the Java Tutorial.

Good Luck,
Avi.
Mark Vermeersch
Greenhorn

Joined: May 11, 2004
Posts: 17
This code works nice. I've added some exceptions and stuff.

Thanks!
 
 
subject: load words from file into a string array