0

我有一个名为 Word 的类,带有 addWord 方法。

public class Word{

   /**constructors exits**/


   /**to addWord and return a boolean value of whether the word is successfully added or not**/
   public boolean addWord (String[] list){

   }

}


public class Test{

   public static void main(String[] args){
      Scanner input = new Scanner;
      String[] wordList = new String[4];
      for (int i=0; i<wordList.length; i++){
         wordList[i]=input.next();
         word.addWord(wordList[i]);
       }
    }
}

我有

错误说:找不到符号

word.addWord(wordList[i];

我该如何纠正?非常感谢!

4

1 回答 1

5

您还没有声明单词实例:

Word word = new Word();
于 2013-06-12T20:32:28.320 回答