File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Anagram Finder program help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Anagram Finder program help" Watch "Anagram Finder program help" New topic
Author

Anagram Finder program help

Kev Woo
Greenhorn

Joined: Nov 03, 2010
Posts: 11
For class we have to create a code which will take a user inputted string of letters and check if there are anagrams of that string in a word list.

My code so far compiles but has two running errors which I've seen so far

1. It will only check every odd word (1st, 3rd, 5th...). If I try to enter an even word it gives me this error: java.util.NoSuchElementException: No line found

2. When it does check, it returns the next word on the list (an even number word).

I think the problem is within the while loop but I can't figure it out.

Thank you in advance

Here's the code:


Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18917
    
  40

Kev Woo wrote:
1. It will only check every odd word (1st, 3rd, 5th...). If I try to enter an even word it gives me this error: java.util.NoSuchElementException: No line found

2. When it does check, it returns the next word on the list (an even number word).

I think the problem is within the while loop but I can't figure it out.


Hint: Take a look at how many words you read in with each iteration of the loop.

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Anagram Finder program help