Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

load words from file into a string array

 
Mark Vermeersch
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ali Gohar
Ranch Hand
Posts: 572
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1141
1
Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This code works nice. I've added some exceptions and stuff.

Thanks!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic