Im trying to write a method that returns the number of words from the "words" parameter that have at least the min" but no more than the "max c"haracters.
public static int countWords(String words, int min, int max)
{
Scanner s = new Scanner (words);
int counter = 0;
while (s.hasNext())
{
String word = s.next();
int wordLength = word.length();
if (wordLength>min && wordLength<max)
{
counter= counter + 1;
s.close();
}
}
return counter;
}