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;
}
}
For each loop need help please
Page 1 of 13 Replies - 1321 Views - Last Post: 02 November 2006 - 11:04 AM
Replies To: For each loop need help please
#2
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.
#3
Re: For each loop need help please
Posted 02 November 2006 - 06:52 AM
Amadeus, 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?
#4
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
Thanks
Lee
Page 1 of 1
|
|

New Topic/Question
Reply




MultiQuote



|