3 Replies - 1449 Views - Last Post: 02 November 2006 - 11:04 AM Rate Topic: -----

#1 Lee1234  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 02-November 06

For each loop need help please

Posted 02 November 2006 - 06:09 AM

I have tried to do a for each loop but i can't get it to work. The closest i have got is for an error to appear saying cannot find symbol when i type in a word.
Below is what i have done at the moment, spent hours and hours doing it and feel as if i am getting nowhere. Its meant to search the arraylist for the word entered and return true if the word exits but mine does not seem to be searching the array list properly. I would be grateful for any hints or help you could give me thank you
Lee

public boolean isKnownWord(String word)
{
for( String word : words)
{
if (words.getDictionary.equals(word))
return true;
else
{return false;
}
}

Is This A Good Question/Topic? 0
  • +

Replies To: For each loop need help please

#2 Amadeus  Icon User is offline

  • g+ + -o drink whiskey.cpp
  • member icon

Reputation: 248
  • View blog
  • Posts: 13,506
  • Joined: 12-July 02

Re: For each loop need help please

Posted 02 November 2006 - 06:48 AM

Is the arraylist global? Because you're not passing the method the array list, only a single word.
Was This Post Helpful? 0
  • +
  • -

#3 Lee1234  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 02-November 06

Re: For each loop need help please

Posted 02 November 2006 - 06:52 AM

View PostAmadeus, on 2 Nov, 2006 - 06:48 AM, said:

Is the arraylist global? Because you're not passing the method the array list, only a single word.


I don't know how to go through one word at a time, i have no idea. What do u means is it global? I got given a list of words called words.txt and i have a DictReader as another class. But in this Spellchecker class i can't get it to find the word. Does what i have written made sense?
Was This Post Helpful? 0
  • +
  • -

#4 Lee1234  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 02-November 06

Re: For each loop need help please

Posted 02 November 2006 - 11:04 AM

I think i have worked it out now or nearly there now so don't worry
Thanks
Lee
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1