• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Scott Selikoff
Bartenders:
  • Piet Souris
  • Jj Roberts
  • fred rosenberger

Anagram Finder program help

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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:


 
author
Posts: 23923
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic