1
当我尝试在单独的类中打印myWords时,我得到一个空白语句。我很确定代码是正确的,但我无法打印出我想要的单词。请帮忙!打印数组语句
public String[] multiLetter (int n, char included)
//public String[] multiLetter(int n, char included)
//returns an array of words with at least m occurrences
//of the letter included
{
for (int i = 0 ; i < words.size() ; i++)
{
int repeatCounter = 0;
for (int j = 0 ; j < words.get(i).length(); j ++)
{
if (included == words.get(i).charAt(j))
{
repeatCounter ++;
}
}//closes inner for loop
if (repeatCounter >= n)
{
myWords.add(words.get(i));
}
}
String [] array = new String [myWords.size()];
return myWords.toArray(array);
}
你永远不会打印任何东西。 –
您遗漏了足够的相关信息,我们无法帮助您。 – csmckelvey
我们需要看到您尝试打印阵列的类 –