-
Poem Generator - HELP
Im in the process of trying to code a poem generator in Java and im stuck.
Basically my program has to read from a text file (one word per line) into an array and then choose 2 random array indexes and the corresponding words.
Using substring strip each word down to the last 3 characters and then use .equals to see if they match.
The rest of the program after that is easy but im so stuck right now 
So far all ive done is open the file and read the length of it, i really could do with some help as to how to read the contents of the file into an array etc.
Thanks in advance
-
So far all ive done is open the file and read the length of it, i really could do with some help as to how to read the contents of the file into an array etc.
What exactly is the problem? Just declare an array of Strings (I'd use a java.util.List personally) and read each line into the next index.
ArchAngel.
O:-)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks